/etc/rsyslog.conf – Setup a Filter to Discard or Redirect Messages

The post outlines steps to create a Property-Based Filter to Discard( suppress ) a particular message or redirect program messages to a particular log file.

 

The syntax

 

The syntax to write a Property-Based Filter is as shown below:

:[Available Properties], [compare-operations], [customized expression] [path/log file]

 

The Discard Action (~)

 

If the discard action is carried out, the received message is immediately discarded. Discard is just the single tilde character with no further parameters.

Example:

*.*   ~      # discards everything.

 

Restart rsyslog

 

You need to restart the rsyslog service after updating the rsyslog.conf

# service rsyslog restart        # CentOS/RHEL 6
# systemctl restart rsyslog      # CentOS/RHEL 7

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)