Apache – Redirecting Access Log to stdout on Linux

apache-2.2debianlinuxlog-fileslogging

Is there any way to intercept Apache (1 or 2) access logs to stdout without :

  • modifying the config files
  • restarting the service

Currently my apache config file specifies "CustomLog /dev/null common"
System is Debian Etch.

Thanks in advance serverfault community !

EDIT : The idea would be to do what "strace -p" does with processes. I hoped apache2ctl or something would have a "dump current accesses" feature 😀

Best Answer

You might want to explain what your requirements and limitations are in more detail if you're looking for a solution to a particular problem. But as it stands, simply:

Can you intercept data going to /dev/null.

Nope.

Can you tell Apache to log elsewhere without modifying it's config files or restarting the service.

Nope.


Update:

It hadn't occured to me of using strace. But indeed, you could use it to inspect the write() calls.

strace -ewrite -s1000 -p<PID>

You're going to run into some difficulty though keeping track of processes. I don't think that strace's fork detection will necessarily help you. Which means that you'll be constantly running around to find which process handled a given request.

As for such a feature in Apache. That's horrible and wouldn't exist. I think you're an edge case ;)