Differentiate internal and real log messages

Issue #352 closed
Gonzalo Diethelm created an issue

Right now Monit generates several log lines for its internal operation, most / all using LogInfo:

2016-04-19T22:20:32.956825+02:00 XXX.com monit[44349]: Shutting down Monit HTTP server
2016-04-19T22:20:33.221827+02:00 XXX.com monit[44349]: Monit HTTP server stopped
2016-04-19T22:20:33.224517+02:00 XXX.com monit[44349]: Starting Monit HTTP server at [10.198.139.31]:2812
2016-04-19T22:20:33.224562+02:00 XXX.com monit[44349]: Monit HTTP server started

And of course there are the "real" log messages:

2016-04-19T22:20:33.224575+02:00 XXX.com monit[44349]: 'some.host.com' Monit reloaded
2016-04-20T04:15:06.588767+02:00 XXX.com monit[44349]: 'carbon-c-relay' process is not running
2016-04-20T04:15:06.672221+02:00 XXX.com monit[44349]: 'carbon-c-relay' trying to restart
2016-04-20T04:15:06.672305+02:00 XXX.com monit[44349]: 'carbon-c-relay' start: /usr/bin/supervisorctl

We would like to separate these two, so that we can easily distinguish the internal and "real" log messages and treat them differently. Would you consider a patch in this direction?

The easiest way I can think of doing this is adding a prefix to the internal messages; something like this:

2016-04-19T22:20:32.956825+02:00 XXX.com monit[44349]: [MONIT] Shutting down Monit HTTP server
2016-04-19T22:20:33.221827+02:00 XXX.com monit[44349]: [MONIT] Monit HTTP server stopped
2016-04-19T22:20:33.224517+02:00 XXX.com monit[44349]: [MONIT] Starting Monit HTTP server at [10.198.139.31]:2812
2016-04-19T22:20:33.224562+02:00 XXX.com monit[44349]: [MONIT] Monit HTTP server started
2016-04-19T22:20:33.224575+02:00 XXX.com monit[44349]: 'some.host.com' Monit reloaded
2016-04-20T04:15:06.588767+02:00 XXX.com monit[44349]: 'carbon-c-relay' process is not running
2016-04-20T04:15:06.672221+02:00 XXX.com monit[44349]: 'carbon-c-relay' trying to restart
2016-04-20T04:15:06.672305+02:00 XXX.com monit[44349]: 'carbon-c-relay' start: /usr/bin/supervisorctl

This prefix could even be configurable; if configured to be empty, Monit could behave as it does today.

Or maybe you have a better idea? Cheers.

Comments (2)

  1. Tildeslash repo owner

    We are always interested in a PR. Before you start, please read the contributing section at https://bitbucket.org/tildeslash/monit/ BTW, I've just committed c8e12ee which makes all the Monit HTTP messages only appear in the log if Monit runs in verbose mode (-v). Basically all internal (verbose) messages should be handled in the same manner and we'll try to do that when we see them. Though having a log entry on Monit start and stop is useful I think.

  2. Tildeslash repo owner

    The "internal" log messages mentioned in this issue have been moved to debug-print. They will only show up in the logs when Monit is run in verbose mode. If you find other types of internal messages please let us know or create a PR

  3. Log in to comment