관리 메뉴

Sysops Notepad

[Linux] 에서 출력되는 systemd 로그 제거하는 방법 본문

업무/sys

[Linux] 에서 출력되는 systemd 로그 제거하는 방법

sysops 2018. 11. 26. 14:36

Centos 7 / RHEL 7 에서 반복되는 로그 제거하는 방법


해당로그는 systemd의 session_start_scope () 함수에 의해 인쇄됩니다. 

이 함수는 cgroup을 만드는 데 사용되며 무시 가능합니다.


# tail /var/log/message


Dec 6 04:01:01 localhost systemd: Created slice user-0.slice.

Dec 6 04:01:01 localhost systemd: Starting Session 63 of user root.

Dec 6 04:01:01 localhost systemd: Started Session 63 of user root.

Dec 6 05:01:01 localhost systemd: Created slice user-0.slice.

Dec 6 05:01:01 localhost systemd: Starting Session 64 of user root.

Dec 6 05:01:01 localhost systemd: Started Session 64 of user root.

Dec 6 06:01:01 localhost systemd: Created slice user-0.slice.

Dec 6 06:01:01 localhost systemd: Starting Session 65 of user root.



# 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 "Removed slice user-" or $msg contains "Stopping user-") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf


# systemctl restart rsyslog



Comments