系统日志中出现大量写入Session of user root

    技术2023-09-09  108

    系统日志中出现大量写入Session of user root

    方法一方法二方法三 当系统日志中出现大量的Session 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-") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf

    方法二

    手动修改配置文件

    将/etc/systemd/system.conf 中 LogLevel=info 设置成如下: #LogLevel=info LogLevel=notice

    方法三

    通过系统命令,修改日志配置文件

    systemd-analyze set-log-level notice
    Processed: 0.008, SQL: 9