systemd-logind负载高
今日发现新的centos7上的systemd-logind的进程经常cpu到达100%, 看了下基本都是无用的日志。但是我总觉得是这是systemd日志处理的一个bug,管理的东西越多就越容易有bug。
0.000695 sendmsg(12, {msg_name(0)=NULL, msg_iov(2)=[{NULL, 0}, {“ion/_322305523\0\0\10\0\0\00022305522\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305522\0\0\10\0\0\00022305521\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305521\0\0\10\0\0\00022305520\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305520\0\0\10\0\0\00022305519\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305519\0\0\10\0\0\00022305518\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305518\0\0\10\0\0\00022305517\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305517\0\0\10\0\0\00022305516\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305516\0\0\10\0\0\00022305515\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305515\0\0\10\0\0\00022305514\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305514\0\0\10\0\0\00022305513\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305513\0\0\10\0\0\00022305512\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305512\0\0\10\0\0\00022305511\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305511\0\0\10\0\0\00022305510\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305510\0\0\10\0\0\00022305509\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305509\0\0\10\0\0\00022305508\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305508\0\0\10\0\0\00022305507\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305507\0\0\10\0\0\00022305506\0\0\0\0\0\0\0/org/freedesktop/login1/session/_322305506\0\0\10\0\0\00022305505\0\0\0\0\0\0\0/org/freedesktop/login1/session/322305505\0\0\10\0\0\00022305504\0\0\0\0*\0\0\0/org/freedesktop/login1/session/
于是就用下面的方法进行关闭了。这样我们的message日志就会干净很多。
echo ‘if ($programname == “systemd” or $programname == “systemd-logind”) and ($msg contains “Starting Session” or $msg contains “Started Session” or $msg contains “Created slice” or $msg contains “Starting user-“ or $msg contains “New session” or $msg contains “Removed session”) then stop’>/etc/rsyslog.d/ignore-systemd-session.conf && systemctl restart rsyslog