“创建切片用户-0.slice。” 和“启动root用户会话2025”。在/ var / log / messages中


11

可以让一些美丽的头脑解释一下“ Created slice user-0.slice”的这些条目是什么。和“启动root用户会话2025”。请在Centos 7的/ var / log / messages中输入?

[root@bew /]# tail -f /var/log/messages
May 26 21:20:01 bew systemd: Created slice user-0.slice.
May 26 21:20:01 bew systemd: Starting Session 2025 of user root.
May 26 21:20:01 bew systemd: Started Session 2025 of user root.
May 26 22:22:33 bew systemd: Stopping System Logging Service...
May 26 22:22:33 bew systemd: Starting System Logging Service...
May 26 22:22:33 bew systemd: Started System Logging Service.
May 26 22:30:01 bew systemd: Created slice user-0.slice.
May 26 22:30:01 bew systemd: Starting Session 2026 of user root.
May 26 22:30:01 bew systemd: Started Session 2026 of user root.

感谢大伙们。


特别是考虑到它在关闭debian时超时

Answers:


5

这些是与会话和资源管理有关的低优先级“信息”级消息。您可以通过以下方式避免它们

# systemd-analyze set-log-level notice

这些消息是否表示root用户已经成功登录?
qwertzguy

1

根据Red Hat的说法,

这些消息是正常现象,是预期的-用户每次登录都会看到这些消息。

如果您不想看到这些消息,则Red Hat提出了一个替代解决方案,以防止在仍然保留服务中其他info级别消息的同时记录它们systemd

  1. rsyslog通过运行以下命令进行修改以创建丢弃过滤器:

    echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf
    
  2. 重新启动rsyslog服务:

    systemctl restart rsyslog
    

if $programname contains "systemd"由于声明了程序名称而不得不更改语句systemd-logind
Aidas
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.