LighttpdVhostErrorlogs

From rsyslog wiki

Jump to: navigation, search

There are much better ways to do this, but I didn't have much time, so here it goes.

lighttpd.conf:

server.errorlog-use-syslog  = "enable"

my_rsyslog_errorlogs.sh:

#!/bin/sh
echo "!lighttpd"
echo "*.*               /var/log/lighttpd.error.full.log"
for i in `pw groupshow clients|cut -f4 -d:|tr "," " "`;do
  echo ":msg,contains,\"home/$i/www\" -/home/$i/www/logs/error"
  echo ":msg,contains,\"home/$i/www\" ~"
done
echo "*.*               /var/log/lighttpd.error.log"

rsyslog.conf:

!lighttpd
*.*             /var/log/lighttpd.error.full.log
:msg,contains,"home/testbitrix/www" -/home/testbitrix/www/logs/error
:msg,contains,"home/testbitrix/www" ~
:msg,contains,"home/phpmyadmin/www" -/home/phpmyadmin/www/logs/error
:msg,contains,"home/phpmyadmin/www" ~
:msg,contains,"home/net2ftp/www" -/home/net2ftp/www/logs/error
:msg,contains,"home/net2ftp/www" ~
...a lot more entries...
*.*             /var/log/lighttpd.error.log



Personal tools
language