How to modify Apache httpd logging
Environment
- Red Hat Enterprise Linux (RHEL)
- Red Hat Software Collections (RHSCL)
- Red Hat JBoss Web Server (JWS)
- Red Hat JBoss Core Services (JBCS)
- Apache Web Server (httpd)
Issue
- How to increase logging level to debug apache issues
- How to reduce the verbosity of the Apache httpd log
- How to customize log level per module
- How to customize log level per directory
- How to enable SSL debug in Apache httpd
- We have some servers dedicated to providing Apache httpd services and we do not need the logging that is produced in the file
/var/log/httpd/*. What is the recommended way to tune thehttpd.conffile to reduce this logging to little or none at all?
Resolution
-
Edit
httpd.conffile and modify the Content from httpd.apache.org is not included.LogLevelto tune the verbosity oferror_log.- From least verbose to most verbose:
emerg,alert,crit,error,warn,notice,info, ordebug. And there's additional verbose log levels fromtrace1totrace8in Apachehttpd2.4. It defaults towarn. - Note: the level
noticecannot be suppressed regardless of theLogLevelsetting as noted in Apache's documentation.
- From least verbose to most verbose:
-
For example, to enable debug logging change from:
LogLevel warnto:
LogLevel debugin
httpd.conf. Then restart the httpd service:]# service httpd restart -
Similarly, for
Apache httpd 2.4.xthe log level can be defined per module and also per directory:LogLevel info ssl:debug proxy:trace8 proxy_ajp:trace8LogLevel info <Directory "/var/www/html/myapp"> LogLevel debug </Directory> -
Afterwards, to supply those logs to Red Hat Support, command
sosreportcan be run with the apache option.]# sosreport -k apache.log=on
SBR
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.