在/var/log/messages中发现大量slice User信息,内容如下
Jan 26 00:01:01 nas systemd: Removed slice User Slice of root.
Jan 26 01:01:01 nas systemd: Created slice User Slice of root.
Jan 26 01:01:01 nas systemd: Started Session 6 of user root.
Jan 26 01:01:01 nas systemd: Removed slice User Slice of root.
Jan 26 02:01:01 nas systemd: Created slice User Slice of root.
Jan 26 02:01:01 nas systemd: Started Session 7 of user root.
Jan 26 02:01:01 nas systemd: Removed slice User Slice of root.
Jan 26 03:01:01 nas systemd: Created slice User Slice of root.
造成大量slice User信息原因是和系统systemd服务有关,可通过配置相关规则,来隐藏这些信息。
隐藏该信息方法:
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
|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | 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 |
systemctl restart rsyslog
|---|---------------------------| | 1 | systemctl restart rsyslog |