On Wed, Dec 18, 2002 at 11:52:23AM +1100, Voytek Eymont wrote:
> I'm looking at setting a number of v-host, and, need to automate/simplify processing
>web logs
> how do I handle on Linux Apache reverse log lookup ,logs per v-host, and deleting
>old logs ?
You can have apache generate separate logs for each virtual host by
having ErrorLog and CustomLog directives in each VirtualHost section in
httpd.conf, for example:
ErrorLog logs/virtual/domain.com.au/error_log
CustomLog logs/virtual/domain.com.au/access_log combined
Add each virtual host's log files to /etc/logrotate.d/apache so that
they're all rotated at the same time.
I use webalizer to produce stats for each virtual host. I do this by
having a webalizer config file for each host in /etc/webalizer/virtual.
There are two directives which need to be different for each host:
OutputDir /var/www/virtual/domain.com.au/html/usage
HostName domain.com.au
I run webalizer from a script in /etc/cron.daily:
#!/bin/sh
for i in /etc/webalizer/virtual/*.conf
do
/usr/sbin/logresolve \
< /var/log/httpd/virtual/`basename $i|sed -e 's/.conf$//'`/access_log \
| /opt/webalizer/bin/webalizer -c $i -p -q
done
It should be fairly easy to write a script to make all the necessary
changes when adding a new virtual host. Apache's config file allows
you to include other files by wildcard pattern, so you can put something
like this in httpd.conf:
Include /etc/httpd/conf/virtual/*.conf
and create one file for each virtual host. This makes automating the
process even easier.
Cheers,
John
--
whois [EMAIL PROTECTED]
GPG key id: 0xD59C360F
http://kirriwa.net/john/
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug