0

How do you stop logging of a specific event on a centos error_log.

I have a file which is blocked via .htaccess but each time it is accessed I get a new line on the log saying:

[Tue Jan 27 09:48:42 2015] [error] [client XX.XX.XXX.XX] client denied by server configuration

I would like to remove this specific message from future reporting as it is growing my log files unnecessarily but keep all other error logging.

Vince P
  • 203
  • 1
  • 4
  • 12
  • Not an exact duplicate. That was about 404, not 403, and the best solution was a workaround that works when file not found but not with allow/deny directives. – Esa Jokinen Mar 18 '15 at 12:42

1 Answers1

1

As answers and their comments in Avoid logging of certain missing files into the Apache2 error log suggest, there is no direct solutions within Apache configuration options.

Allowing every possible variants in logging including advanced filtering would increase the amount of Apache's own code enormously. Therefore Apache has capabilities for piped logging.

In addition to CustomLog directives they should also work within ErrorLog directive.

ErrorLog "|/path/to/log_filtering_script >>/path/to/logfile"
Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129