mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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 <ezomori.nozomu@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Daniel Kobras <d.kobras@science-computing.de> Closes #6886 Closes #7260
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
: "${ZED_DEBUG_LOG:="${TMPDIR:="/tmp"}/zed.debug.log"}"
|
||||
|
||||
zed_exit_if_ignoring_this_event
|
||||
|
||||
lockfile="$(basename -- "${ZED_DEBUG_LOG}").lock"
|
||||
|
||||
umask 077
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
|
||||
. "${ZED_ZEDLET_DIR}/zed-functions.sh"
|
||||
|
||||
zed_exit_if_ignoring_this_event
|
||||
|
||||
zed_log_msg "eid=${ZEVENT_EID}" "class=${ZEVENT_SUBCLASS}" \
|
||||
"${ZEVENT_POOL_GUID:+"pool_guid=${ZEVENT_POOL_GUID}"}" \
|
||||
"${ZEVENT_VDEV_PATH:+"vdev_path=${ZEVENT_VDEV_PATH}"}" \
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -100,3 +100,14 @@ ZED_USE_ENCLOSURE_LEDS=1
|
||||
#
|
||||
#ZED_SYSLOG_TAG="zed"
|
||||
|
||||
##
|
||||
# Which set of event subclasses to log
|
||||
# By default, events from all subclasses are logged.
|
||||
# If ZED_SYSLOG_SUBCLASS_INCLUDE is set, only subclasses
|
||||
# matching the pattern are logged. Use the pipe symbol (|)
|
||||
# or shell wildcards (*, ?) to match multiple subclasses.
|
||||
# Otherwise, if ZED_SYSLOG_SUBCLASS_EXCLUDE is set, the
|
||||
# matching subclasses are excluded from logging.
|
||||
#ZED_SYSLOG_SUBCLASS_INCLUDE="checksum|scrub_*|vdev.*"
|
||||
#ZED_SYSLOG_SUBCLASS_EXCLUDE="statechange|config_*|history_event"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user