Bug 37307

Summary: Can't suppress error messages
Product: Apache httpd-2 Reporter: Timor Hatamy <timorhatamy>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED LATER    
Severity: enhancement CC: DRuggeri
Priority: P2 Keywords: MassUpdate
Version: 2.0.54   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Timor Hatamy 2005-10-31 08:45:28 UTC
It is about one month that an unknown server frequently calls a non-existing 
page on my server. Eventually, I have blocked that IP in httpd.conf but the 
error messages are still filling up the server error logs and I have found no 
way to adjust apache to suppress those messages. If this option would exist in 
apache server, it would be a very grate help.
Comment 1 Nick Kew 2005-10-31 13:48:48 UTC
What are you asking for?  Something like the env=foo argument to CustomLog  
that'll suppress Errorlog logging? 
Comment 2 Rainer Jung 2005-11-01 20:05:27 UTC
Exactly that is something I would find useful too. 

I know situations where load balancers test http server accessibility using
probing requests. In case of https it is not uncommon, that they don't really do
a full SSL handshake and as a result you get an entry in the error_log and
ssl_engine_log every time the load balancer probes.

env=foo for Errorlog (and also the SSLlog) would be great.
Comment 3 Tim 2006-01-12 18:16:43 UTC
The idea is very simple; Apache has only 8 directives for error log levels:
debug, info, notice, warn, error, crit, alert and emerg.

But there is no possibility to select only those error messages that we would 
like to gather.
Foe example, I would be interested of only some specific notification [notice] 
messages and some from [warn] group.
Each time I have a server crash, I open the server error log file and after 
hundreds of times reading the same line like "Disabled use of AcceptEx() 
WinSock2 API" I start to swear on my fathers grave that I know that I have 
disabled the use of "AcceptEx() WinSock2 API" in the httpd.conf file and I 
would very much like to choke that output! :(((
Comment 4 Daniel Ruggeri 2010-03-29 20:35:47 UTC
It would seem to me that the only way to be able to do this would be to create a new directive "SuppressErrorLogMatching" that accepts a regular expression and then check the log messages in a lower level function like log_error_core.

I would be happy to write a patch to accomplish this, but I would like input from the devs as to the feasibility.

1. Add to the conf: SuppressErrorLogMatching "Disabled use of AcceptEx"
2. Allow multiple occurrences of this directive?
3. In the startup, compile the regular expression to ensure validity and add the ap_regex_t struct to an array or as a single item (depending on whether we should allow multiple occurrences)
4. During every call to log_error_core, check the regex against the log message and return immediately if it matches

While it's all I can come up with to suit the request, I have concerns about the approach. This could easily increase load depending on the level and amount of logging. Although we would be dealing with a compiled regex, we still have to spend the time to know if it matches - adding those cycles to all log messages in debug level with something like mod_ssl dumping data would be rather nasty to do.
Comment 5 William A. Rowe Jr. 2018-11-07 21:09:17 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.