Looks nice, I will try it out. I assume you have to run this script in /etc/httpd/conf.d/ ?
–
JakobudAug 5 '11 at 17:06

no I have it in my /etc/apache/vhosts/ - if you move it, just change your paths, or possibly add a path parameter pointing to the apache includes directory... If you wanted to get it real sexy, you could also have it create the virtual host directory structure & jack a cname into your nameserver configs....
–
Sean KimballAug 5 '11 at 17:28

2

You could clean that up using a big here document. Variable expansions are still processed inside.
–
MikeyBAug 5 '11 at 18:39

Make sure /usr/local/bin/apacheawklogpipe is executable. All you would need to take care of with this script, is create a directory in /var/log/httpd/access that corresponds to the virtualhostname. I had a script that would create a virtualhost config and create the log directories.

Another options. Don't split them in httpd.conf. Instead, log everything to your main Access Log, and then split them later with a program like split-logfile. This helps to simplify your log configuration.

By adding
information on the virtual host to the log format string, it is
possible to log all hosts to the same log, and later split the log
into individual files. For example, consider the following directives.

The %v is used to log the name of the virtual host that is serving the
request. Then a program like split-logfile can be used to post-process
the access log in order to split it into one file per virtual host.

That sounds like a nightmare. If I have 30 active sites and I want to look through the log for a single site I have to either sift through a HUGE log file or split it out everytime? Not to mention running a tail -f would suck horribly... No thanks.
–
JakobudAug 5 '11 at 19:36

1

To each his own. I wouldn't want 2x30 logfiles sitting around, and this works well with Simple dynamic virtual hosts. The idea here is to handle log processing afterwards. tail -f access_log | grep www.example.org works well enough. So does a a central syslog/Splunk server.
–
Stefan LasiewskiAug 5 '11 at 20:45