monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom log file


From: Jan-Henrik Haukeland
Subject: Re: Custom log file
Date: Tue, 10 May 2005 22:59:19 +0200

I have some comments. First, I strongly encourage you to try and refactor the current log implementation. If you have to delete all of the old log.c file, that's fine - no problem, but please let's try *not* to have two implementations or ways to log in monit. I understand that it is easier to bypass the old code, but in the long run it is easier for us to maintain one code base for logging and it is easier for users to have one way to setup logging.

Other comments,

a) Support syslog, by either using the old code or add new code
b) Make the default log format the same as the old format used in monit. That is, if no log format was specified, the old format is used. c) Drop "set customlog" and use the standard "set logfile" and support the syslog keyword d) Drop "set customlog format" and use [set logformat "..."] You could or probably should have a condensed version like [set logfile / var/logs/monit.log and use logformat "..."]

Both c and d above is based on that we should only have one way to setup logging in monit.

I can understand why you will want to add a severity and maybe an alarmdid to a certain event, as suggested here,

check host localhost with address 127.0.0.1
   if failed port 80 protocol http then
      alert and log "message" alarmid 33 severity warning

This looks OK to me and I cannot see how this could be done better? If you, behind the scene go the extra mile and make "log" a real event like alert, exec and so on, you will also have (almost) implemented this planed feature, http://www.tildeslash.com/monit/doc/ next.php#21 which would be great :-) Another thing, if "message" should be part of this log statement, it should probably also override the default message generated by monit when this event is logged?

Other than that, this very looks promising!


On 10. mai. 2005, at 19.49, Marco Ermini wrote:

Sorry for the cross-post. I was not sure which lists was the best to ask...

I am implementing the custom log feature for monit. I am doing it very
tight to my needs, however since I am doing it, I think is it worth
asking if someone wants some different features, or maybe tell me that
I am going in the wrong way.

I am not changing the "standard" log file; I find it better (for
compatibility issues and simplicity, too) to implement a new log file
which would be possible to customize.

The keywords I programmed were two "set" statements and an extension
of the "event" case:

1) set customlog <PATH> (i.e /var/log/custommonit.log)

It creates the custom log file in a similar way than the "normal" log
file - the only difference is that it cannot be syslog (could it be
useful? I don't think so).

2) set customlog format <STRING> (default "%D, %T, %A, %S, %M, %T")

The format will use the following substitutions; %D=date, %T=time,
%A=alarm-number, %S=severity, %M=message text, %T=event type
(suggestions for other substitutions are welcome).

Then I added the possibility to specify a custom log for every event
which could occurs, to populate the custom log with the appropriate
string whichever events occurs. I.e.:

check host localhost with address 127.0.0.1
   if failed port 80 protocol http then alert log "message" alarmid 33
severity warning
   if failed port 8080 type tcp then alert else if recovered then
unmonitor log "message" alarmid auto severity warning

the keywords I added are:

log = to be inserted AFTER the "then" statement or "recovered"
statement, if present

alarmid = Numerical ID which unequivocal identifies an alarm. It will
be used to correlate alarm events with clear events (recovers). The
alarm and the correspondent clear will have the same ID, only that the
clear will have severity=normal. If you specify alarmid=auto monit
will use a

severity = must be on of the following: NORMAL WARNING MINOR MAJOR
CRITICAL FATAL - "normal" should be used to clear an alarm and is
automatically used in the case of recover, but monit will not really
check whichever severity you choose - this is up to you.


Of course it follows the logic of my particular needs (although it
should be useful to many people here), but if someone have a request,
since I am already digging into the CVS code... just ask :-)


Regards.
--
Marco Ermini

--
Jan-Henrik Haukeland
Mobil +47 97141255





reply via email to

[Prev in Thread] Current Thread [Next in Thread]