Subversion hosting, CVS hosting, Trac hosting, Bugzilla hosting and software collaboration Providing hosted Subversion, CVS, Trac and Bugzilla repositories
 

April 7, 2008

Keeping VMware Management Log Files Under Control

Filed under: Operating Systems — Tags: , — Greg Larkin @ 2:01 pm

Hi everyone,

I recently upgraded the production servers to VMware Server 1.0.5 and also upgraded the VMware MUI package. The MUI (Web-based Management Interface) is useful when you need to restart a VM, reallocate VM memory and perform other maintenance tasks, but you don’t have access to the VMware Server Console or VirtualCenter.

The MUI is driven by Apache 1.3.31, and as such, it generates the familiar log files:

/var/log/vmware-mui/access_log
/var/log/vmware-mui/error_log
/var/log/vmware-mui/ssl_engine_log
/var/log/vmware-mui/ssl_request_log

However, after a while, the log directory tends to fill up:
# ls -larS
total 78988
drwxr-xr-x  14 root root     4096 Apr  7 11:58 ..
drwxr-xr-x   2 root root     4096 May  9  2007 .
-rw-r--r--   1 root root    53985 Mar 24 09:20 error_log
-rw-r--r--   1 root root  8280230 Apr  7 12:59 access_log
-rw-r--r--   1 root root  9955524 Apr  7 12:59 ssl_request_log
-rw-r--r--   1 root root 62473978 Apr  7 12:59 ssl_engine_log

Ok, it’s only 78Mb so far, but why wait until the logs fill up the disk? Since the VMware Server host is running RHEL4, it came pre-installed with logrotate, and an existing configuration for the standard Apache log rotation can be easily adapted for the VMware Server MUI. Just place the following in /etc/logrotate.d/httpd.vmware:
/var/log/vmware-mui/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.vmware.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

The default settings in /etc/logrotate.conf also take effect during rotation and you can enable log file compression and length of retention in there.


Call me - Greg Larkin: Offline

January 31, 2008

Apache Auto-configuration with a Dynamic IP Address

Filed under: Operating Systems — Tags: , , — Greg Larkin @ 6:02 pm

Hi everyone,

As I was setting up the new FreeBSD 6.2 VM with Apache 2.2 preinstalled in it, I ran into a problem. The VM’s virtual Ethernet adapter is configured for DHCP, and the VMware software acts as a DHCP server to hand out IP addresses as VMs are started.

The problem is that Apache likes to know the IP address of the machine it’s running on, and in some cases, it won’t start unless it does. Luckily, the DHCP client in FreeBSD, and likely other operating systems, calls separate hook scripts (if they exist) before and after configuring the adapter with a dynamic address.

In my case, I wanted to automatically create a ServerName directive for Apache with the dynamic address. The default Apache 2.2 installation on FreeBSD provides a user configuration file include directory at /usr/local/etc/apache22/Includes. As it starts up, Apache loads any file placed in that directory and named with the “.conf” suffix. I think we’ve got a solution!

It’s also necessary to tweak the contents of the /etc/hosts file so that the VM can resolve its own hostname. I wrote a DHCP client exit hook script that configures both Apache and the /etc/hosts file. This script should be easily adaptable to other operating systems, as it uses the standard Bourne shell syntax.

Simply download the script, unzip the contents into /etc, and let me know what you think!


Call me - Greg Larkin: Offline

Powered by WordPress