In a previous post, I postulated a solution for rotating the Apache log files produced by the VMware MUI application. Unfortunately, the MUI version of Apache doesn’t work well with logrotate, as I discovered over the weekend.
After receiving an alert on the cell phone in the middle of the night that the MUI was down, I discovered this in the
[Sun Apr 13 04:02:03 2008] [error] Could not destroy the stale named pipe directory: /var/run/vmware//httpd/21157\n [Sun Apr 13 04:02:03 2008] [error] VMWARE PANIC: \nNOT_IMPLEMENTED F(4023):707\n [Sun Apr 13 04:02:03 2008] [error] Panic: Could not allocate temporary context.\n
Ok, perhaps there’s a better solution than logrotate and one that I’m already using with Apache in all of the SourceHosting.net virtual machines. A while back, I discovered the httplog tool, which builds on the premise of the standard rotatelogs tool that’s part of the Apache distribution. Since it doesn’t restart Apache when it rotates its log files, I suspected it might work well with the MUI.
Since the MUI is running on a RHEL4 system, I created an RPM of httplog instead of installing directly from the source distro. After many years working with Linux and FreeBSD, I much prefer everything to be installed from an RPM or a port, just for sanity’s sake and managing future upgrades.
The next step is to integrate the httplog command into the MUI’s
httpd.conf file, found in
/usr/lib/vmware-mui/apache/conf. If you’d like to update your file, download this patch file, and run the following commands (after installing httplog):
rm -f /etc/logrotate.d/httpd.vmware /etc/rc.d/init.d/httpd.vmware stop patch -b --verbose /usr/lib/vmware-mui/apache/conf/httpd.conf < httpd.conf.httplog-patch /etc/rc.d/init.d/httpd.vmware start
After starting up httpd.vmware, your
/var/log/vmware-muidirectory should look something like this:
total 16 lrwxrwxrwx 1 root root 36 Apr 14 17:12 error_log -> /var/log/vmware-mui/200815-error_log -rw-r--r-- 1 root root 186 Apr 14 17:12 200815-error_log lrwxrwxrwx 1 root root 41 Apr 14 17:12 ssl_engine_log -> /var/log/vmware-mui/200815-ssl_engine_log lrwxrwxrwx 1 root root 42 Apr 14 17:16 ssl_request_log -> /var/log/vmware-mui/200815-ssl_request_log lrwxrwxrwx 1 root root 37 Apr 14 17:16 access_log -> /var/log/vmware-mui/200815-access_log -rw-r--r-- 1 root root 396 Apr 14 17:31 200815-ssl_request_log -rw-r--r-- 1 root root 3820 Apr 14 17:31 200815-ssl_engine_log -rw-r--r-- 1 root root 328 Apr 14 17:31 200815-access_log
I’ve got my httplog process configured to encode the week number into the Apache log filenames, rotate them each week and compress the rotated logs. If you want to automatically remove compressed logs after a certain number of weeks, a simple cron job accomplishes that.
httplog accepts many different filename configurations, so man httplog for more information or post questions here.
Keep in touch,