diff options
author | Tony Hutter <[email protected]> | 2018-03-06 15:41:52 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-06 15:41:52 -0800 |
commit | 639b18944a6a3483c02039621c02dac08a954a90 (patch) | |
tree | b50499c540b1da61c4fe677d0a4d0a8d7e42570f /cmd/zed/zed.d/zed-functions.sh | |
parent | d2160d053838e36df83e5fe3a9ca20abad588a4c (diff) |
Allow to limit zed's syslog chattiness
Some usage patterns like send/recv of replication streams can
produce a large number of events. In such a case, the current
all-syslog.sh zedlet will hold up to its name, and flood the
logs with mostly redundant information. Two mitigate this
situation, this changeset introduces to new variables
ZED_SYSLOG_SUBCLASS_INCLUDE and ZED_SYSLOG_SUBCLASS_EXCLUDE
to zed.rc that give more control over which event classes end
up in the syslog.
Reviewed-by: loli10K <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Signed-off-by: Daniel Kobras <[email protected]>
Closes #6886
Closes #7260
Diffstat (limited to 'cmd/zed/zed.d/zed-functions.sh')
-rw-r--r-- | cmd/zed/zed.d/zed-functions.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/zed/zed.d/zed-functions.sh b/cmd/zed/zed.d/zed-functions.sh index ed6a95914..fb16e9d36 100644 --- a/cmd/zed/zed.d/zed-functions.sh +++ b/cmd/zed/zed.d/zed-functions.sh @@ -438,3 +438,23 @@ zed_guid_to_pool() $ZPOOL get -H -ovalue,name guid | awk '$1=='"$guid"' {print $2}' fi } + +# zed_exit_if_ignoring_this_event +# +# Exit the script if we should ignore this event, as determined by +# $ZED_SYSLOG_SUBCLASS_INCLUDE and $ZED_SYSLOG_SUBCLASS_EXCLUDE in zed.rc. +# This function assumes you've imported the normal zed variables. +zed_exit_if_ignoring_this_event() +{ + if [ -n "${ZED_SYSLOG_SUBCLASS_INCLUDE}" ]; then + eval "case ${ZEVENT_SUBCLASS} in + ${ZED_SYSLOG_SUBCLASS_INCLUDE});; + *) exit 0;; + esac" + elif [ -n "${ZED_SYSLOG_SUBCLASS_EXCLUDE}" ]; then + eval "case ${ZEVENT_SUBCLASS} in + ${ZED_SYSLOG_SUBCLASS_EXCLUDE}) exit 0;; + *);; + esac" + fi +} |