Advertise here: Contact FM.


How to disable apache logging?
October 17, 2006 1:21 PM   RSS feed for this thread Subscribe

How do you disable access logging in Apache2?

And yes, I did first RTFM. It's inaccurate.

The manual says to merely comment out the CustomLog directive. Unforutnately, this results in the logging defaulting to standard access logging. What's the actual best practice to completely disable access logging on an apache 2 server? Version 2.0. 52 on Redhat.

(This is for a high load server, and we're using an external logging system...)
posted by SpecialK to computers & internet (7 comments total)
Try sending the CustomLog output to /dev/null.
posted by xmutex at 1:33 PM on October 17, 2006


xmutex, that will just discard the logs, not disable logging. It will save space, but you won't get the performance benefits.

I'll take a look and see. I may be needing to do this myself before too long.
posted by Captain_Tenille at 1:35 PM on October 17, 2006


Thanks, Tenille. At least I know I'm not stupid and missing something. ;)
posted by SpecialK at 2:13 PM on October 17, 2006


I'm no Apache Ninja but is this controlled by the log_config_module.so? Would preventing this module from loading do the trick?
posted by mmascolino at 2:59 PM on October 17, 2006


Try this:

SetEnv dontlog 1
CustomLog logs/access_log common env=!dontlog

This says "Set the environment variable dontlog to 1 for every request. Log every request that doesn't have dontlog set."
posted by murphy slaw at 4:07 PM on October 17, 2006


I looked at mefi, which doesn't have logging, and all my CustomLog entries on the virtual host domains are commented out, but I noticed that further up in the config the combined and common calls out to log files are also commented out.

Did you try doing a search for "log" in the conf file and commenting out anything that calls up access.log ?
posted by mathowie at 4:30 PM on October 17, 2006


I'm going to take a guess here and say that most of the overhead of logging comes not from generating the log even (the calls to ap_log_*) but from flushing the log file to disk.

So try redirecting the log to /dev/null and see if that doesn't increase performance. Remember to set your log format to "" so that it doesn't do any work building that.

Also, if you go murphy slaw's route, there's no reason do make a call to SetEnv. Just do something like:

CustomLog logs/access_log "" env=DOES_NOT_EXIST
posted by sbutler at 5:44 PM on October 17, 2006


« Older PetPsychologyFilter: Our 8 yea...   |   I get migraines from MSG (incl... Newer »
This thread is closed to new comments.