Matching Expressions

You can configure the switch so messages reaching the target match a specified match expression.

The message text is compared with the configured match expression to determine whether to pass the message on. To require that messages match a match expression, use the following command:

configure log target [console | memory-buffer | nvram | primary-node| backp-node | session | syslog [all | ipaddress {udp-port {udp_port}} | ipPort | ipaddress tls-port {tls_port} ] {vr vr_name} {local0 ... local7}] match [any |match-expression]

The messages reaching the target will match the match-expression, a simple regular expression. The formatted text string that makes up the message is compared with the match expression and is passed to the target if it matches. This command does not affect the filter in place for the target, so the match expression is compared only with the messages that have already passed the target‘s filter. For more information on controlling the format of the messages, see Formatting Event Messages.

Simple Regular Expressions

A simple regular expression is a string of single characters including the dot character (.), which are optionally combined with quantifiers and constraints. A dot matches any single character, while other characters match only themselves (case is significant). Quantifiers include the star character (*) that matches zero or more occurrences of the immediately preceding token. Constraints include the caret character (^) that matches at the beginning of a message and the currency character ($) that matches at the end of a message. Bracket expressions are not supported. There are a number of sources available on the Internet and in various language references describing the operation of regular expressions. The following table shows some examples of regular expressions.

Table 1. Simple Regular Expressions
Regular Expression Matches Does Not Match

port

port 2:3

import cars

portable structure

poor

por

pot

..ar

baar

bazaar

rebar

bar

port.*vlan

port 2:3 in vlan test

add ports to vlan

port/vlan

myvlan$

delete myvlan

error in myvlan

myvlan port 2:3

ports 2:4,3:4 myvlan link down