| |
tech:centos7_slice [2020/08/18 11:02] – 建立 jonathan_tsai | tech:centos7_slice [2021/01/16 14:41] (目前版本) – 更換 plugin jonathan |
---|
====== CentOS7 出現 slice User 訊息的解法 ====== | ====== CentOS7 出現 slice User 訊息的解法 ====== |
* CentOS 7 的 /var/log/messages 系統紀錄內會大量出現 slice User 的訊息如下: <xtermrtf> | * CentOS 7 的 /var/log/messages 系統紀錄內會大量出現 slice User 的訊息如下: <cli> |
Aug 18 08:34:49 ct-squid systemd: Removed slice User Slice of root. | Aug 18 08:34:49 ct-squid systemd: Removed slice User Slice of root. |
Aug 18 09:30:01 ct-squid systemd: Created slice User Slice of root. | Aug 18 09:30:01 ct-squid systemd: Created slice User Slice of root. |
Aug 18 10:54:22 ct-squid systemd: Started Session 33128 of user root. | Aug 18 10:54:22 ct-squid systemd: Started Session 33128 of user root. |
Aug 18 10:54:22 ct-squid systemd-logind: New session 33128 of user root. | Aug 18 10:54:22 ct-squid systemd-logind: New session 33128 of user root. |
</xtermrtf> | </cli> |
* 主要的原因是和 systemd 服務有關, 可以透過紀錄篩選規則設定, 來隱藏這些 slice User 訊息, 設定方式如下:<code sh> | * 主要的原因是和 systemd 服務有關, 可以透過紀錄篩選規則設定, 來隱藏這些 slice User 訊息, 設定方式如下:<code sh> |
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 | 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 |