views:

175

answers:

1

Is there a way to stop Apache creating error_log files using .htaccess ?

+2  A: 

There is probably no way to do that apart doing something funny like

ErrorLog "|/bin/true"

has you can see in the manual this directive is only available in a server config and a virtualhost. If you want to delete certain log entry for particular URLS, you can make a script that would filter those lines and use something like:

ErrorLog "|/path/to/your/script.pl"

On the same fashion you can lower the log level to pretty much nothing with this:

LogLevel emerg

this won't avoid having the file but it would be probably few lines long or 0 byte. Also you cannot use .htaccess to that, you have to have access to the server config.

Last point, I am not really sure what you are intending to do but log files are valuable security information and you might need them in case you have to investigate some problems, security events (hack, audit) or even statistics. If it's a problem you have too much logs, I advice you to take a look at log rotation software, maybe cronolog would help you to manage it better.

RageZ