Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Configuring the System Log Priority of the Triggering Event in an Event Policy

    Understanding the Event System Log Priority in an Event Policy

    Starting with Junos OS Release 12.1, you can configure an event policy to override the default system log priority of a triggering event so that the system logs the event with a different facility type, severity level, or both. To override the priority of the triggering event, configure the priority-override statement at the [edit event-options policy policy-name then] hierarchy level. To override the facility type with which the triggering event is logged, include the facility statement and the new facility type. To override the severity level with which the triggering event is logged, include the severity statement and the new severity level.

    Junos OS processes generate system log messages, or event notifications, to record the events that occur on a routing, switching, or security platform. Each system log message identifies the Junos OS process that generated the message and describes the operation or error that occurred. The Junos OS event process (eventd) receives the event notifications, and configured event policies instruct the eventd process to perform a set of actions upon receipt of specific events or correlated events.

    Each system log message belongs to a facility, which groups messages that either are generated by the same source (such as a software process) or concern a similar condition or activity (such as authentication attempts). Each message is also preassigned a severity level, which indicates how seriously the triggering event affects the functions of the routing, switching, or security platform. A message’s facility and severity level are together referred to as its priority. For more information about facility and severity levels, see Junos OS System Logging Facilities and Message Severity Levels.

    When you configure logging on a device for a specific facility and destination, you also specify a severity level. Messages from that facility that are rated at the configured severity level or higher are logged. To log related events with different severity levels in the same log file, you must filter events using the lowest severity level of any of the events from that facility to be logged. This can result in unwieldy log files that are difficult and time-consuming to parse.

    For example, Junos OS logs the protocol UP and DOWN events with different severity levels. Both the SNMP_TRAP_LINK_DOWN and SNMP_TRAP_LINK_UP events have a facility of 'daemon', but the SNMP_TRAP_LINK_DOWN event has a severity level of 'warning', and the SNMP_TRAP_LINK_UP event has a severity level of 'info'. Normally, when you configure a system log file, you must filter events to that file using the lower severity level of 'info' in order to log both of the events.

    The event policy priority-override statement enables you to customize the priority of the triggering event so that it is logged using a different facility type and severity level. Suppose you configure a system log file to filter events of facility 'daemon' and severity 'notice’, and you have event policies that trigger on the RPD_ISIS_ADJDOWN and RPD_ISIS_ADJUP events. When the system generates an RPD_ISIS_ADJDOWN message reporting that the IS-IS adjacency with a neighboring router was terminated, this message is logged. However, if the system subsequently generates an RPD_ISIS_ADJUP event notification reporting that the IS-IS adjacency has been restored, by default, the message is not logged, because it has a lower severity level of 'info'. In the event policy that triggers on the RPD_ISIS_ADJUP event, you can configure the associated priority so that the triggering RPD_ISIS_ADJUP event is logged with a severity level of 'notice' and is captured in the configured log file.

    Note: Event policies are executed in the order in which they appear in the configuration. When you configure multiple event policies to override the priority of the same event, the event is logged based on the priority set by the last executed event policy to change it.

    Example: Configuring the Event System Log Priority in an Event Policy

    It is necessary to log events when monitoring, managing, and troubleshooting routing, switching, and security devices. Starting with Junos OS Release 12.1, you can configure an event policy to override the priority of its triggering event so that it is logged based on a different facility type and severity level. This enables the event to be logged even if the system filters events to the destination log file using a different facility type or a higher severity level.

    This example simulates an SNMP_TRAP_LINK_UP event for a specific interface. Upon receipt of the event, the event policy overrides the severity level of the event so that it is captured in the configured log file.

    Requirements

    • Routing, switching, or security device running Junos OS Release 12.1 or later.
    • Interface is configured and active. This example uses the ge-0/3/1.0 interface.

    Overview

    This example configures two log files to capture events of facility 'daemon'. One log file is configured to filter for events of severity 'warning' or higher, and the second log file is configured to filter for events of severity 'info' or higher.

    The configured event policy triggers on the SNMP_TRAP_LINK_UP event for interface ge-0/3/1.0. The example generates an SNMP_TRAP_LINK_DOWN event followed by an SNMP_TRAP_LINK_UP event for the ge-0/3/1.0 interface. The SNMP_TRAP_LINK_DOWN event, which has a severity level of 'warning' is captured in both configured log files. Upon receipt of the SNMP_TRAP_LINK_UP event, the event policy overrides the severity level of the event to 'warning' so that it is also captured in the log file that filters for events of severity 'warning'. By default, if the event policy does not override the severity level of this event, it is only captured in the log file that filters for the severity level 'info'.

    Configuration

    CLI Quick Configuration

    To quickly configure this example, copy the following commands, paste them in a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level:

    set system syslog file syslog-event-daemon-info daemon infoset system syslog file syslog-event-daemon-warning daemon warningset event-options policy log-on-snmp-trap-link-up events snmp_trap_link_upset event-options policy log-on-snmp-trap-link-up attributes-match snmp_trap_link_down.interface-name matches ge-0/3/1.0set event-options policy log-on-snmp-trap-link-up then priority-override severity warning

    Configuring the Log Files

    Step-by-Step Procedure

    1. Configure two log files at the [edit system syslog] hierarchy level to record events of facility daemon.

      Configure one log to record events of severity 'info' or higher and one log file to record events of severity 'warning' or higher.

      [edit system syslog]bsmith@R1# set file syslog-event-daemon-info daemon infobsmith@R1# set file syslog-event-daemon-warning daemon warning
    2. Commit the configuration.

      bsmith@R1# commit
    3. To manually test the logging of the events, take the ge-0/3/1.0 logical interface temporarily offline, and then bring it back up.

      This generates an SNMP_TRAP_LINK_DOWN event followed by an SNMP_TRAP_LINK_UP event.

      [edit]bsmith@R1# set interfaces ge-0/3/1 unit 0 disablebsmith@R1# commitbsmith@R1# delete interfaces ge-0/3/1 unit 0 disablebsmith@R1# commit

    Results

    [edit]
    system {syslog {file syslog-event-daemon-info {daemon info;}file syslog-event-daemon-warning {daemon warning;}}}

    Verifying the Default System Log Priority of the Events

    Purpose

    Verify that the system generated the SNMP_TRAP_LINK_DOWN and SNMP_TRAP_LINK_UP events for the ge-0/3/1.0 interface, and note where each event is logged.

    Action

    Review the contents of the syslog-event-daemon-info file configured in Step 1 of the previous procedure. The output shows that the ge-0/3/1.0 interface was brought down and back up and generated an SNMP_TRAP_LINK_DOWN event followed by an SNMP_TRAP_LINK_UP event.

    bsmith@R1> show log syslog-event-daemon-info
    Oct 24 13:22:17  R1 mib2d[1394]: SNMP_TRAP_LINK_DOWN: ifIndex 539, ifAdminStatus down(2), ifOperStatus down(2), ifName ge-0/3/1.0
    ...
    Oct 24 13:22:29  R1 mib2d[1394]: SNMP_TRAP_LINK_UP: ifIndex 539, ifAdminStatus up(1), ifOperStatus up(1), ifName ge-0/3/1.0

    Review the contents of the syslog-event-daemon-warning file configured in Step 1 of the previous procedure. Because the severity level of the SNMP_TRAP_LINK_UP event is 'info', it does not appear in a log file that is configured to only record events of severity 'warning' or higher. By default, this system log file captures the SNMP_TRAP_LINK_DOWN events, but does not capture the SNMP_TRAP_LINK_UP events.

    bsmith@R1> show log syslog-event-daemon-warning
    Oct 24 13:22:17  R1 mib2d[1394]: SNMP_TRAP_LINK_DOWN: ifIndex 539, ifAdminStatus down(2), ifOperStatus down(2), ifName ge-0/3/1.0

    Meaning

    Because the SNMP_TRAP_LINK_UP event has a default severity of 'info', it is not forwarded to log files that are configured to capture events of higher severity.

    Configuring the Event Policy

    Step-by-Step Procedure

    1. Create and name the event-policy.

      [edit]bsmith@R1# edit event-options policy log-on-snmp-trap-link-up
    2. Configure the events statement.

      For this example, the event policy triggers on the SNMP_TRAP_LINK_UP event. Set the attributes-match statement so that the policy triggers only if the SNMP_TRAP_LINK_UP event occurs for the ge-0/3/1.0 interface.

      [edit event-options policy log-on-snmp-trap-link-up]bsmith@R1# set events snmp_trap_link_upbsmith@R1# set attributes-match snmp_trap_link_down.interface-name matches ge-0/3/1.0
    3. Configure the priority-override event policy action, and include the severity statement with a value of warning.

      [edit event-options policy log-on-snmp-trap-link-up]bsmith@R1# set then priority-override severity warning
    4. Commit the configuration.

      bsmith@R1# commit
    5. To manually test the event policy, take the ge-0/3/1.0 logical interface temporarily offline, and then bring it back up. This generates an SNMP_TRAP_LINK_DOWN event followed by an SNMP_TRAP_LINK_UP event.

      [edit]bsmith@R1# set interfaces ge-0/3/1 unit 0 disablebsmith@R1# commitbsmith@R1# delete interfaces ge-0/3/1 unit 0 disablebsmith@R1# commit

    Results

    [edit]
    event-options {policy log-on-snmp-trap-link-up {events snmp_trap_link_up;attributes-match {snmp_trap_link_up.interface-name matches ge-0/3/1.0;}then {priority-override {severity warning;}}}}

    Verification

    Confirm that the configuration is working properly.

    Verifying the Configured System Log Priority of the Events

    Purpose

    Verify that the system generated the SNMP_TRAP_LINK_DOWN and SNMP_TRAP_LINK_UP events for the ge-0/3/1.0 interface, and note where each event is logged.

    Action

    Review the contents of the syslog-event-daemon-warning file. Because the event policy overrides the severity level of the SNMP_TRAP_LINK_UP event, it now appears in the log file that is configured to only record events of severity 'warning' or higher. By default, this system log file captures the SNMP_TRAP_LINK_DOWN events, but does not capture the SNMP_TRAP_LINK_UP events.

    bsmith@R1> show log syslog-event-daemon-warning
    Oct 24 13:29:48  R1 mib2d[1394]: SNMP_TRAP_LINK_DOWN: ifIndex 539, ifAdminStatus down(2), ifOperStatus down(2), ifName ge-0/3/1.0
    Oct 24 13:30:02  R1 mib2d[1394]: SNMP_TRAP_LINK_UP: ifIndex 539, ifAdminStatus up(1), ifOperStatus up(1), ifName ge-0/3/1.0

    Meaning

    Although the SNMP_TRAP_LINK_UP event has a severity of 'info', configuring the priority-override statement with a severity of 'warning' causes the event to be forwarded to the system logs with the configured severity level. The event can be captured in logs that filter for a different facility type and a higher severity level.

    Published: 2013-03-05