概述
使用top命令查看内存占用时,发现rsyslogd内存占用很高。
解决
修改rsyslogd服务配置文件vim /usr/lib/systemd/system/rsyslog.service
在Service配置中添加MemoryAccounting=yes,MemoryMax=80M,MemoryHigh=8M三项来限制服务内存使用率,如下所示[Unit]
Description=System Logging Service
;Requires=syslog.socket
Wants=network.target network-online.target
After=network.target network-online.target
Documentation=man:rsyslogd(8)
Documentation=http://www.rsyslog.com/doc/
[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/rsyslog
ExecStart=/usr/sbin/rsyslogd -n $SYSLOGD_OPTIONS
Restart=on-failure
UMask=0066
StandardOutput=null
Restart=on-failure
MemoryAccounting=yes
MemoryMax=80M
MemoryHigh=8M
[Install]
WantedBy=m