Please notice: This article is more than 3 years old
Content, Source code or links may no longer be correct in the meantime.
Please notice: This article is more than 3 years old
Content, Source code or links may no longer be correct in the meantime.
I’ve started using Apache-Exporter1 for monitoring and checking this weekend how useful it is and how it can be integrated into my Prometheus2 monitoring enviroment. The server-status requests inevitably lead to more “background noise” in the Apache logfiles. The screenshot below clearly shows in the upper less section:
Of course the requests cannot be prevented, but you can manipulate what Apache writes in its logfiles. It’s called conditional logging and allows you to set variables with SetEnvIf3 to any regex on each request. With SetEnvIfExpr it is even possible to perform expressions4, for instance to check if a request comes from your inside network segments:
SetEnvIfExpr "-R '10.0.0.0/8' || -R '172.16.0.0/12' || -R '192.168.0.0/16'" isInternal
In my case I set the variable “dontlog” on all Server-Status requests and exclude it explicitly in the logging:
SetEnvIf Request_URI "^/server-status(.*)$" dontlog
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined env=!dontlog
Further regex statements e.g. for certain file extensions are possible aswell but should be done with caution. Ultimately, too many exceptions tend to make a usually sharp tool for debugging less reliable.
Never trust a log unless it comes from yourself!