11

I have a new CentOS 7 installation, and noticed that my /var/log/messages file is full of messages like this

Mar  6 08:40:01 myhostname systemd: Started Session 2043 of user root.
Mar  6 08:40:01 myhostname systemd: Starting Session 2043 of user root.
Mar  6 08:40:01 myhostname systemd: Created slice user-1001.slice.
Mar  6 08:40:01 myhostname systemd: Starting user-1001.slice.
Mar  6 08:40:01 myhostname systemd: Started Session 2042 of user userx.
Mar  6 08:40:01 myhostname systemd: Starting Session 2042 of user userx.
Mar  6 08:40:01 myhostname systemd: Started Session 2041 of user root.
Mar  6 08:40:01 myhostname systemd: Starting Session 2041 of user root.
Mar  6 08:40:31 myhostname systemd: Removed slice user-1001.slice.
Mar  6 08:40:31 myhostname systemd: Stopping user-1001.slice.
Mar  6 08:41:01 myhostname systemd: Created slice user-1001.slice.
Mar  6 08:41:01 myhostname systemd: Starting user-1001.slice.
Mar  6 08:41:01 myhostname systemd: Started Session 2044 of user userx.
Mar  6 08:41:01 myhostname systemd: Starting Session 2044 of user userx.
Mar  6 08:41:21 myhostname systemd: Removed slice user-1001.slice.
Mar  6 08:41:21 myhostname systemd: Stopping user-1001.slice.

What do all of these mean, and why are they there? If this is normal background noise them it seems like an enourmous waste to of resources to log this...

14

(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:

  • Had to change if statement to if $programname contains "systemd" because program name is called systemd-logind – Aidas Jan 15 at 10:21
  • @Aidas, out of curiosity, what distro/systemd version? – fusorx Jan 16 at 12:53
  • 1
    CentOS Linux release 7.5.1804 (Core) – Aidas Feb 12 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.