CentOS 7 / RHEL7 一直出現 systemd: 的 LOG

 

CentOS 7 / RHEL 7 的 /var/log/messages,如果一直出現以下 LOG

Sep 28 11:51:01 localhost systemd: Starting Session 466 of user root.
Sep 28 11:51:01 localhost systemd: Started Session 467 of user root.
Sep 28 11:51:01 localhost systemd: Starting Session 467 of user root.
Sep 28 11:51:01 localhost systemd: Started Session 470 of user root.
Sep 28 11:51:01 localhost systemd: Starting Session 470 of user root.
Sep 28 11:51:01 localhost systemd: Started Session 468 of user root.
Sep 28 11:51:01 localhost systemd: Starting Session 468 of user root.
Sep 28 11:51:01 localhost systemd: Started Session 469 of user root.
Sep 28 11:51:01 localhost systemd: Starting Session 469 of user root.
Sep 28 11:51:01 localhost systemd: Started Session 471 of user root.
Sep 28 11:51:01 localhost systemd: Starting Session 471 of user root.
Sep 28 11:52:01 localhost systemd: Started Session 473 of user root.
Sep 28 11:52:01 localhost systemd: Starting Session 473 of user root.
Sep 28 11:52:01 localhost systemd: Started Session 472 of user root.
Sep 28 11:52:01 localhost systemd: Starting Session 472 of user root.
Sep 28 11:52:01 localhost systemd: Started Session 475 of user root.
Sep 28 11:52:01 localhost systemd: Starting Session 475 of user root.
Sep 28 11:52:01 localhost systemd: Started Session 474 of user root.
Sep 28 11:52:01 localhost systemd: Starting Session 474 of user root.
Sep 28 11:52:01 localhost systemd: Started Session 476 of user root.
Sep 28 11:52:01 localhost systemd: Starting Session 476 of user root.
Sep 28 11:52:01 localhost systemd: Started Session 477 of user root.
Sep 28 11:52:01 localhost systemd: Starting Session 477 of user root.

Red Hat 網站上有解決方案

執行以下指令

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

其實是新增一個 rsyslog 的設定檔 /etc/rsyslog.d/ignore-systemd-session-slice.conf

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

再將 rsyslog 服務重新啟動

systemctl restart rsyslog.service

再觀察 /var/log/messages,應該就不會再出現 systemd 的 LOG 了。

廣告
本篇發表於 Bookmark, CentOS 7, Linux, RHEL 7, ubuntu。將永久鏈結加入書籤。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google photo

您的留言將使用 Google 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s