[thelist] Re: Can Apache put only certain codes in log files?

Anthony Baratta Anthony at Baratta.com
Mon Sep 23 13:47:01 CDT 2002


At 11:11 AM 9/23/2002, Benjamin wrote:
>A search on Google
>for [apache "conditional logging" "status code"] was unfruitful as well
>unfortunately.  At the moment there doesn't seem to be a way to handle your
>particular request (nor my question posed a few days ago either).

Properly configured, Apache should have all errors recorded to the ErrorLog.

e.g.

Outside of the virtual host directive....

    ErrorLog /dir/path/to/logs/error_log

Will be the defaut location for the server. You must have write access to
the target directory for the user that Apache runs as for this file to be
created and written to.

Inside the virtual host directive....

<VirtualHost 123.123.123.123:80>
         ServerAdmin root at foo.com
         ServerName www.foo.com
         ServerAlias foo.com
         DocumentRoot /path/to/dir/foo.com
         ScriptAlias /cgi-bin/ "/path/to/dir/foo.com/cgi-bin/"
         ErrorLog /path/to/dir/logs/foo-error.log
         CustomLog /path/to/dir/logs/foo-access.log common
</VirtualHost>

This will create an Access log and an Error log just for the target virtual
web service.

Apache does not support breaking out by Error Code, not does it support
filtering what is written to the Access log out side of the formatting
options for the Log Format.

http://httpd.apache.org/docs/mod/mod_log_config.html#customlog
http://httpd.apache.org/docs/mod/mod_log_config.html#formats

What I think both of you are attempting to do is forego using log analysis
software and micro manage your log files. While on the surface this appears
to be a good thing (tm), I think you are focusing too much on a particular
tree type and not utilizing the bio-diversity of the forest (e.g. access
and error logs) to your advantage.

Check out web analysis software like analog ( http://www.analog.cx/ ) and
webalizer ( http://www.mrunix.net/webalizer/ ).

You'll be much happier in the long run.
--
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list