ARC: Cache arc_c value during arc_evict()
[zfs.git] / cmd / zed / zed.d / all-syslog.sh
blob5f601144a97c0ac95d3a843777eb7ded77a1c042
1 #!/bin/sh
2 # shellcheck disable=SC2154
4 # Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC.
5 # Copyright (c) 2020 by Delphix. All rights reserved.
9 # Log the zevent via syslog.
12 [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
13 . "${ZED_ZEDLET_DIR}/zed-functions.sh"
15 zed_exit_if_ignoring_this_event
17 # build a string of name=value pairs for this event
18 msg="eid=${ZEVENT_EID} class=${ZEVENT_SUBCLASS}"
20 if [ "${ZED_SYSLOG_DISPLAY_GUIDS}" = "1" ]; then
21 [ -n "${ZEVENT_POOL_GUID}" ] && msg="${msg} pool_guid=${ZEVENT_POOL_GUID}"
22 [ -n "${ZEVENT_VDEV_GUID}" ] && msg="${msg} vdev_guid=${ZEVENT_VDEV_GUID}"
23 else
24 [ -n "${ZEVENT_POOL}" ] && msg="${msg} pool='${ZEVENT_POOL}'"
25 [ -n "${ZEVENT_VDEV_PATH}" ] && msg="${msg} vdev=${ZEVENT_VDEV_PATH##*/}"
28 # log pool state if state is anything other than 'ACTIVE'
29 [ -n "${ZEVENT_POOL_STATE_STR}" ] && [ "$ZEVENT_POOL_STATE" -ne 0 ] && \
30 msg="${msg} pool_state=${ZEVENT_POOL_STATE_STR}"
32 # Log the following payload nvpairs if they are present
33 [ -n "${ZEVENT_VDEV_STATE_STR}" ] && msg="${msg} vdev_state=${ZEVENT_VDEV_STATE_STR}"
34 [ -n "${ZEVENT_CKSUM_ALGORITHM}" ] && msg="${msg} algorithm=${ZEVENT_CKSUM_ALGORITHM}"
35 [ -n "${ZEVENT_ZIO_SIZE}" ] && msg="${msg} size=${ZEVENT_ZIO_SIZE}"
36 [ -n "${ZEVENT_ZIO_OFFSET}" ] && msg="${msg} offset=${ZEVENT_ZIO_OFFSET}"
37 [ -n "${ZEVENT_ZIO_PRIORITY}" ] && msg="${msg} priority=${ZEVENT_ZIO_PRIORITY}"
38 [ -n "${ZEVENT_ZIO_ERR}" ] && msg="${msg} err=${ZEVENT_ZIO_ERR}"
39 [ -n "${ZEVENT_ZIO_FLAGS}" ] && msg="${msg} flags=$(printf '0x%x' "${ZEVENT_ZIO_FLAGS}")"
41 # log delays that are >= 10 milisec
42 [ -n "${ZEVENT_ZIO_DELAY}" ] && [ "$ZEVENT_ZIO_DELAY" -gt 10000000 ] && \
43 msg="${msg} delay=$((ZEVENT_ZIO_DELAY / 1000000))ms"
45 # list the bookmark data together
46 # shellcheck disable=SC2153
47 [ -n "${ZEVENT_ZIO_OBJSET}" ] && \
48 msg="${msg} bookmark=${ZEVENT_ZIO_OBJSET}:${ZEVENT_ZIO_OBJECT}:${ZEVENT_ZIO_LEVEL}:${ZEVENT_ZIO_BLKID}"
50 zed_log_msg "${msg}"
52 exit 0