Stop rsyslog Create slice, Removed slice from log messages CentOS

In Centos 7/8 /var/log/messages is flooded with this :

Aug 9 14:46:01 web systemd: Created slice User Slice of root.
Aug 9 14:46:01 web systemd: Started Session 10626 of user root.
Aug 9 14:46:01 web systemd: Removed slice User Slice of root.

You can stop this with adding a rule to rsyslog ignoring all these, adding a rule like : /etc/rsyslog.d/ignore-systemd-session-slice.conf

if $programname == "systemd" and 
  (
  $msg contains "Starting Session" or 
  $msg contains "Started Session" or 
  $msg contains "Created slice" or
  $msg contains "Starting user-" or 
  $msg contains "Starting User Slice of" or 
  $msg contains "Removed session" or 
  $msg contains "Removed slice User Slice of" or 
  $msg contains "Stopping User Slice of"
  )
then stop
sudo systemctl restart rsyslog


Posted

in

Tags: