Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Healthcheck spam #11

Closed
STaRDoGG opened this issue Aug 24, 2022 · 3 comments
Closed

Healthcheck spam #11

STaRDoGG opened this issue Aug 24, 2022 · 3 comments
Assignees
Labels
docker help wanted Extra attention is needed

Comments

@STaRDoGG
Copy link
Contributor

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):

image

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:

COPY copy-files/configs/apache/000-default /etc/apache2/sites-available/default

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.

@JulianPrieber JulianPrieber transferred this issue from LinkStackOrg/linkstack-themes Aug 25, 2022
@JulianPrieber
Copy link
Member

If you open a pull request for this, I'll include it

@JulianPrieber JulianPrieber added help wanted Extra attention is needed docker labels Sep 6, 2022
@JulianPrieber JulianPrieber pinned this issue Sep 27, 2022
@JulianPrieber JulianPrieber closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2022
@JulianPrieber JulianPrieber changed the title Couple tips Healthcheck spam Sep 27, 2022
@STaRDoGG
Copy link
Contributor Author

Sorry about the delay, I haven't logged in for a minute.

I'll add it as soon as I get a chance.

@STaRDoGG
Copy link
Contributor Author

STaRDoGG commented Oct 14, 2022

Turned out to be a bit more of a PITA than I thought it would be, but finally wrapped it all up.: #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants