/var/log/messages |
服务信息日志(记录linux操作系统常见的服务信息和错误信息) |
/var/log/secure |
系统的登陆日志(记录用户和工作组的变化情况,是系统安全日志,用户的认证登陆情况 |
/var/log/maillog |
邮件日志 |
/var/log/cron |
定时任务 |
/var/log/boot.log |
系统启动日志 |
发现/var/log/messages有几个G的日志。查看日志内容发现rsyslog把Journal的log都进行的输出和汇总。
当容器越多是,log也就会也多,内存占用也就越多。
消减输出的日志,将log级别定义为err级别
修改rsyslogd配置文件/etc/rsyslog.conf
*.err;mail.none;authpriv.none;cron.none /var/log/messages
重启服务
systemctl daemon-reload systemctl restart rsyslogshell复制代码
- 1
- 2
修改Journal的配置/etc/systemd/journald.conf
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See journald.conf(5) for details. [Journal] #Storage=auto #Compress=yes #Seal=yes #SplitMode=uid #SyncIntervalSec=5m #RateLimitInterval=30s #RateLimitBurst=1000 SystemMaxUse=8G #SystemKeepFree= SystemMaxFileSize=10M #RuntimeMaxUse= #RuntimeKeepFree= #RuntimeMaxFileSize= MaxRetentionSec=1month #MaxFileSec=1month ForwardToSyslog=no #ForwardToKMsg=no #ForwardToConsole=no ForwardToWall=no #TTYPath=/dev/console #MaxLevelStore=debug #MaxLevelSyslog=debug #MaxLevelKMsg=notice #MaxLevelConsole=info #MaxLevelWall=emerg #LineMax=48K复制代码
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
重启服务
systemctl restart systemd-journaldshell复制代码
- 1
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wind.kaisa@gmail.com
最后一次更新于2022-01-30
