Creating custom apache logfile names for your multisite instances

tags:

One of the great features of Drupal is its ability to run any number of sites from one base installation, a feature generally referred to as multisites . Creating a new site is just a matter of creating a settings.php file and (optionally) a database to go with your new site. That's it. More importantly, there's no need to set up complicated Apache Virtual hosts, which are a wonderful feature of Apache, but can be very tricky and tedious, especially if you're setting up a large number of subsites.

No worries, there is a solution.

Create a new LogFormat

Copy the LogFormat of your choice, prepend the HTTP host field, and give it a name:

LogFormat "%{Host}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vcombined 
 

Get the script

Next, download the attached script (split-logfile) and store it somewhere like /usr/bin (don't for get to chmod 755 that baby!)

Now, tell apache to use pipe logfiles to your script rather than writing them directly to disk:
CustomLog "| /usr/bin/split-logfile" vcombined 

Restart Apache

/etc/rc.d/init.d/httpd restart

That's it.

Naturally, you may have to modify split-logfile if you don't store your logfiles in the default location.

 

 

This doesn't appear to work. The log files in question get created, but nothing is ever written to them even after a chmod 777.

I could really use some help, and I'm hoping your willing to share some savvy - did I say hoping :-)

I think I have some fairly basic multisite needs:
*Multiple sites running on single code base.
*Each site with its own database
*test-site(s)

My environment & access:
*I have leased a spanking new LAMP server with WHM/cPanel GUI from softlayer.com (about $300 with some 24/7/365 support)
*I have root access
*I use PuTTY to do most of my non-WHM work

What I've done thus far:
*I've got the drupal core in /var/www/html
I've created the directory "www.mydomain.com" in the "sites" directory: sites/www.mydomain.com
*Inside sites/all, I've created the modules/custom, modules/contrib, themes/custom and themes/contrib
*I've also cp -rp sites/default sites/www.mydomain.com so that settings.php has been copied into www.mydomain.com

I don't know what to do next. I've read the INSTALL.txt, and many, many (many!) articles, book pages, forum topics, etc. and I'm still at the same place - unsure what to do next. I don't want to run willy-nilly, but want this to be "simple and practical"; if it isn't there are usually legacy problems later.

I could use some help.

Thanks,

-Doug