System log full of session and slice messages

(this question is also answered over on superuser here )

Those are messages pertaining to the creation and deletion of slices, which are used in systemd to group processes and manage their resources.

Why they are logged by default escapes me but I've seen two ways to disable them:

  1. The less intrusive way is to filter them out by creating /etc/rsyslog.d/ignore-systemd-session-slice.conf with the following contents:

    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 "Removed Slice" or $msg contains "Stopping user-") then stop
    

    and restart rsyslogd with systemctl restart rsyslog

  2. The broader way is to set the systemd logging level a bit higher by editing /etc/systemd/system.conf:

     #LogLevel=info
     LogLevel=notice
    

References:

  • https://access.redhat.com/solutions/1564823

  • I have more but can't post more than 2 links. Hooray.


These messages are normal and expected -- they will be seen any time a user logs in

To suppress these log entries in /var/log/messages, create a discard filter with rsyslog, e.g., run the following command:

echo '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' >/etc/rsyslog.d/ignore-systemd-session-slice.conf

Then restart the rsyslog service

systemctl restart rsyslog

https://access.redhat.com/solutions/1564823

Tags:

Syslog