You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed in the logs there's what I call "healthcheck spam" that makes it hard to glean important stuff when needed. I get around this in my containers like this (it still does the healthcheck, but doesn't spam the log):
in the dockerfile I put:
# Container healthcheck
HEALTHCHECK CMD curl -ILfSs http://localhost:80 -A "HealthCheck: J. Scott Elblein/1.0" || exit 1
# Forward Apache access and error logs to Docker's log collector
RUN ln -sf /dev/stdout /var/log/apache2/access.log \
&& ln -sf /dev/stderr /var/log/apache2/error.log
and then in apache's 00-default config, I add near the bottom:
<IfModule setenvif_module>
# If UA matched healthcheck, set 'nolog' env var, which we exclude from the log(s) in the logformat section below.
BrowserMatchNoCase ^healthcheck nolog
</IfModule>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!nolog
The -A sets the UserAgent (can be whatever ya want; I used 'healthcheck') and then the browsermatchnocase searches for "healthcheck", and if found, just doesn't add it to the log.
I create that 00-default locally and then copy it via the dockerfile:
Also, I see the 'harmless but annoying ;)' log message:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.0.5.5. Set the 'ServerName' directive globally to suppress this message
For that, I create a file named fqdn with this in it: ServerName localhost, and copy it via docker file:
# Shut the 'fully qualified yada yada yada' Apache warning notice up
COPY copy-files/configs/fqdn /etc/apache2/conf.d
I'm a bit OCD about making my logs as easy to find what I need fast, lol. Not sure whether that's important to you but thought I'd help out if you were interested.
The text was updated successfully, but these errors were encountered:
I noticed in the logs there's what I call "healthcheck spam" that makes it hard to glean important stuff when needed. I get around this in my containers like this (it still does the healthcheck, but doesn't spam the log):
in the dockerfile I put:
and then in apache's
00-default
config, I add near the bottom:The
-A
sets the UserAgent (can be whatever ya want; I used 'healthcheck') and then the browsermatchnocase searches for "healthcheck", and if found, just doesn't add it to the log.I create that
00-default
locally and then copy it via the dockerfile:Also, I see the 'harmless but annoying ;)' log message:
For that, I create a file named
fqdn
with this in it:ServerName localhost
, and copy it via docker file:I'm a bit OCD about making my logs as easy to find what I need fast, lol. Not sure whether that's important to you but thought I'd help out if you were interested.
The text was updated successfully, but these errors were encountered: