From 5c1af1bad76fbd6f8996f09de16cd32f81224354 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 25 Feb 2012 17:31:23 +0100 Subject: [PATCH] syslog plugin: Change notification severity handling. This way it is more like log severity handling, i.e. "OKAY" implies "WARNING" and "WARNING" implies "FAILURE". Change-Id: I972c09e4bc9e26b5abeb17cc4d8c5e0e1a42e1c3 --- src/collectd.conf.pod | 12 ++++++------ src/syslog.c | 9 ++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index c5a75dc7..2be3c939 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4232,14 +4232,14 @@ syslog-daemon. Please note that B is only available if collectd has been compiled with debugging support. -=item B B|B +=item B B|B|B Controls which notifications should be sent to syslog. The default behaviour is -not to send any. If either of C or C is used, C notifications -will also be sent to syslog. -Notifications will be sent using severities based on their own levels. B -and B will be sent using syslog B severity, whereas B -will yield a B syslog entry. +not to send any. Less severe notifications always imply logging more severe +notifications: Setting this to B means all notifications will be sent to +syslog, setting this to B will send B and B +notifications but will dismiss B notifications. Setting this option to +B will only send failures to syslog. =back diff --git a/src/syslog.c b/src/syslog.c index d584eec9..fd313dd7 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -85,13 +85,8 @@ static int sl_notification (const notification_t *n, int status; int severity; - /* do nothing if parsing of NotifSeverity failed */ - if (notif_severity == -1) - return 0; - /* do nothing if NotifSeverity is higer than notification - * note that OKAY notifs will always be displayed */ - if ((notif_severity == NOTIF_FAILURE) && (n -> severity == NOTIF_WARNING)) - return 0; + if (n->severity > notif_severity) + return (0); status = ssnprintf (buf_ptr, buf_len, "Notification: severity = %s", (n->severity == NOTIF_FAILURE) ? "FAILURE" -- 2.30.2