优化journald日志服务配置

pull/505/head
gjmzj 2019-03-28 12:45:03 +08:00
parent b684e96b6f
commit ece94ff0b4
2 changed files with 29 additions and 0 deletions

View File

@ -42,3 +42,16 @@
- name: 把SCTP列入内核模块黑名单
copy: src=sctp.conf dest=/etc/modprobe.d/sctp.conf
# 优化设置 journal 日志相关
- name: 准备 journal 日志相关目录
file: name={{ item }} state=directory
with_items:
- "/etc/systemd/journald.conf.d"
- "/var/log/journal"
- name: 优化设置 journal 日志
template: src=95-k8s-journald.conf.j2 dest=/etc/systemd/journald.conf.d/95-k8s-journald.conf
- name: 重启 journald 服务
service: name=systemd-journald state=restarted

View File

@ -0,0 +1,16 @@
[Journal]
# 持久化保存到磁盘
Storage=persistent
# 最大占用空间 2G
SystemMaxUse=2G
# 单日志文件最大 200M
SystemMaxFileSize=200M
# 日志保存时间 2 周
MaxRetentionSec=2week
# 禁止转发
ForwardToSyslog=no
ForwardToWall=no