Viewing Filter Configuration Information

Syntax:

show logging filter name

Displays the logging filter’s configuration information. The Matches column indicates the number of times that criteria has matched.

Specifying the criteria for a filter and then enabling the filter

switch(config)# logging filter SevWarnFatal 10 severity warning permit
switch(config)# logging filter SevWarnFatal 20 severity major permit
switch(config)# logging filter SevWarnFatal default deny

switch(config)# logging filter SevWarnFatal enable
  1. The filter named SevWarnFatal adds a sub-filter of the severity type, with a sequence number of 10. The sub-filter specifies that a match for an event log message with a severity of “warning” will be logged.

  2. The second sub-filter has a sequence number of 20 and a severity type of major. The sub-filter specifies that a match for an event log message with a severity of “major” will be logged.

  3. The default sub-filter, which is created automatically at the time of filter creation, is always the last entry in the filter module. It matches “anything” and cannot be changed. You can change the actions to either permit or deny. This example specifies that any message that did not meet the prior matching criteria will not be logged.

  4. The last command enables the filter named SevWarnFatal. If there was another filter enabled, this filter automatically replaces it and the other filter is disabled.

Specifying the criteria for a filter named noUpDownEvents and then enabling the filter

switch(config)# logging filter noUpDownEvent 10 event-num 76 deny
switch(config)# logging filter noUpDownEvent 20 event-num 77 deny
switch(config)# logging filter noUpDownEvent default permit

switch(config)# logging filter noUpDownEvent enable
  1. The filter named noUpDownEvents adds a sub-filter with a type of event-num, and a sequence number of 10. The sub-filter specifies that a match for an event log message with an event number of “76” will not be logged.

  2. The second sub-filter has a sequence number of 20 and a type of event-num. The sub-filter specifies that a match for an event log message with an event number of “77” will not be logged.

  3. The default sub-filter, which is created automatically at the time of filter creation, is always the last entry in the filter module. It matches “anything” and cannot be changed. You can change the actions to either permit or deny. This example specifies that any message that did not meet the prior matching criteria will be logged.

  4. The last command enables the filter named noUpDownEvents. If there was another filter enabled, this filter automatically replaces it and the other filter is disabled.

Specifying the criteria for a match using a regular expression and then enabling the filter

switch(config)# logging filter noUpPorts 10 "(A10|A22|B5) is now on-line" deny
switch(config)# logging filter noUpPorts default permit

switch(config)# logging filter noUpPorts enable

This example denies logging of the matching regular expression “port <port-num> is now on-line” for ports A10, A22, and B5.

  1. The filter named noUpPorts adds a sub-filter with a type of regular expression for ports A10, A22, and B5. The sub-filter specifies the matching criteria for the regular expression and if there is a match, the event log message is not logged.

  2. The default sub-filter specifies that any message that did not meet the prior matching criteria will be logged.

  3. The last command enables the filter named noUpPorts.

Specifying the criteria for a match using a regular expression for specific ports

switch(config)# logging filter noStpBlockPorts 10 "(A[1-9]|A10|B[1-4])
.*Blocked by STP" permit
switch(config)# logging filter noStpBlockPorts 20 " .*Blocked by STP" deny
switch(config)# logging filter noStpBlockPorts default permit

switch(config)# logging filter noStpBlockPorts enable
  1. The filter named noStpBlockPorts adds a sub-filter with a type of regular expression with a sequence number of 10. This rule specifies that event messages from ports A1-A10, and B1-B4 with the “.*Blocked by STP” expression pattern in the message body are logged.

  2. The second command adds a sub-filter with a type of regular expression and a sequence number of 20. This rule specifies that event messages generated from any ports with the “.*Blocked by STP” expression pattern in the message body are not logged.

  3. The default sub-filter specifies that any message that did not meet the prior matching criteria will be logged.

  4. The last command enables the filter named noStpBlockPorts.

Output examples:

The configured logging filters

Switch# show logging filter

 Status and Counters - Log Filters Information

  Name            Enabled
  --------------- -------
  noUpPorts       No
  SevWarnFatal    No
  noUpDownEvents  No
  noStpBlockPorts Yes

Output for specified logging filters

Switch# show logging filter sevWarnFatal

 Status and Counters - Log Filters Information

  Name             : Enabled
  Enabled          : Yes
  Messages Dropped : 0

  Seq Type      Value                               Action Matches
  --- --------  ----------------------------------  ------ -------
  10  Severity  warning                             Permit 2
  20  Severity  major                               Permit 2
  def          (any)                                Deny   0


switch(config)# show logging filter noStpBlockPorts

 Status and Counters - Log Filters Information

  Name             : noStpBlockPorts
  Enabled          : Yes
  Messages Dropped : 0

  Seq Type      Value                                Action Matches
  --- --------  -----------------------------------  ------ -------
  10  RegExp    (A[1-9]|A10|B[1-4]).*Blocked by STP  Permit 2
  20  RegExp    .*Blocked by STP                     Deny   2
  def           (any)                                Permit 0

Output of running-config file

Switch# show running-config

Running configuration:

; J9470A Configuration Editor; Created on release #XX.15.13.0000x
; Ver #04:0f.ff.3f.ef:24
hostname "Switch"
module 1 type j94dda
logging filter "noUpPorts" 10 "(A10|A22|B5) is now on-line" deny
logging filter "noUpPorts" default permit
logging filter "SevWarnFatal" 10 severity warning permit
logging filter "SevWarnFatal" 20 severity major permit
logging filter "SevWarnFatal" default deny
logging filter "noUpDownEvent" 10 event-num 76 deny
logging filter "noUpDownEvent" 20 event-num 77 deny
logging filter "noUpDownEvent" default permit
logging filter "noStpBlockPorts" 10 "(A[1-9]|A10|B[1-4]) .*Blocked by STP" permit
logging filter "noStpBlockPorts" 20 " .*Blocked by STP" deny
logging filter "noStpBlockPorts" default permit
logging filter "noStpBlockPorts" enable
snmp-server community "public" unrestricted
snmp-server host 15.255.133.156 community "public"
snmp-server host 15.255.133.146 community "public"
vlan 1
.
.
.