journald.conf日志配置不生效


#1
  • 配置了一下journald.conf然而好像么有作用
  • 15m的刷新时间并没有实现 是我理解错了还是配置错了?
  • cat /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=persistent
#Compress=yes
#Seal=yes
# 确保每个用户都能读取自己的日志文件
SplitMode=uid
# 向磁盘刷写日志文件的时间间隔,默认值是五分钟
SyncIntervalSec=15m
# 限制日志的生成速度
RateLimitIntervalSec=1h
#RateLimitBurst=1000
# 改变日志存贮大小
SystemMaxUse=100M
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#日志文件的最大保留期限
MaxRetentionSec=1month
#MaxFileSec=1month
#ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg

  • 修改之后
    systemctl restart systemd-journald

  • 用iotop看了一下还是不停的写日志


#2

看了一下好像有的设置生效了

/var/log/journal/a0848146a8854c519ce698d28901e824/
总用量 37392
-rw-r-----  1 root systemd-journal  8388608 11月  3 18:09 system@7eeab8a2f55a4b25bed8941d39511feb-000000000000e6e9-000579b68a7eadcb.journal
-rw-r-----+ 1 root systemd-journal 13107200 11月  3 18:09 user-1005@9f0ae2eef11e4148b1a00017e0ff9bc7-000000000000e6ea-000579b68b9a77f1.journal
-rw-r-----  1 root systemd-journal  8388608 11月  4 07:38 system.journal
-rw-r-----+ 1 root systemd-journal  8388608 11月  4 07:38 user-1005.journal