Lighttpd – Separate log files for each vhost

I could not resist digging into my administrative and shell experience when I saw that somebody wrote a php script to dynamically split lighttpd logs. Hmm I use php for more complicated stuff.

I achieved this by putting the following into lighttpd.conf

accesslog.filename          = "|/usr/bin/"

The following is the listing for, shell veterans, please comment if I am overdoing this. Since my exposure is of very low.



cat - | while read line
   dom=$(echo $line | cut -f2 -d" ")
   echo $line >> $logDir/${dom}-access.log