We have a live help on our server that generates an insane amount of access logs as you can imagine. Currently they're appended to all of the other access logs for the site they run on. This makes it difficult to sort through the error logs. Is there a way I can specify that anything within /livehelp go into a different log file?

<Directory "/livehelp">
     CustomLog /my/custom/access.log combined
     ErrorLog /my/custom/apache2/error.log
  • Can I put this within a <virtualHost *:80></virtualHost> ? – Webnet Jul 23 '10 at 14:38
  • if you want to apply this on a virtual host, you should put it into that virtual host configuration. – Ehsan Jul 23 '10 at 14:45
  • At least on my test here you can't put CustomLog and ErrorLog inside a <Directory> – coredump Jul 23 '10 at 14:48
  • @coredump - that's the same thing that happened here, it threw an error. – Webnet Jul 23 '10 at 15:03

If you move /livehelp to its own VirtualHost (which requires its own HostName) you can customize the logs to keep them separate. You would use the CustomLog and ErrorLog directives to specify the location for those logs.

<VirtualHost *:80>
        ServerName livehelp.example.com
        DocumentRoot /path/to/the/livehelp/folder
        ErrorLog logs/livehelp-error_log
        CustomLog logs/livehelp-access_log combined

You could use the piped log [1] feature of apache. Create a shell script like



if [ "x$1" == "xlive" ]; then

grep $FLAGS "$PATTERN" > $2

(untested and needs improvement)

now add

CustomLog "|/path/to/script live /var/log/live" combined 


CustomLog "|/path/to/script std /var/log/std" combined 

to the apache config

you can add some more filtering here if you need

[1] http://httpd.apache.org/docs/2.2/logs.html#piped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.