大网数据广告活动
服务器运维问答

Systemd journal files smaller than SystemMaxFileSize

· 52CE 我爱测

I have a system running CentOS 7, with more than 1T free disk space. The systemd version is 219. I have configured journald with the following settings: Storage=persistent SplitMode=none SystemMaxUse=50G SystemMaxFileSize=1G #Max…

问题原文

原帖链接 · joaerl · CC BY-SA 3.0

I have a system running CentOS 7, with more than 1T free disk space. The systemd version is 219. I have configured journald with the following settings:

Storage=persistent
SplitMode=none
SystemMaxUse=50G
SystemMaxFileSize=1G
#MaxFileSec=1month (default)

However, the resulting journal files are smaller than 1G, they are cut at about 500M, as can be seen in this screen shot.

I'm doing intense testing of the system, the log is filled with more than 1G per day, so it is not the MaxFileSec that is kicking in. I noted that the group id differs for the files, maybe that is a clue. However, as seen by the time stamps in the screenshot, the two log files on top does not seem to be filled anymore.

My question is, why are the size of the journal files not reaching the configured 1G?

Edit: Corrected parameter names as pointed out by Mark below, it was correct on the system though.

已采纳解答

原帖链接 · Mark Stosberg · CC BY-SA 3.0

Nothing in the docs in man journald.conf promises to make the log files as large as SystemMaxFileSize=. The docs only promise not to exceed that limit.

From an amateur reading of the C source code, my interpretation is that there is a "minimum file size", but that is only 512k, so that shouldn't be in play here. There is also "FILE_SIZE_INCREASE", which is related to allocating incremental file growth. My reading is to expect the file size to grow within 8 MB of the SystemMaxFileSize before rotation happens.

If you search the whole systemd source tree for SystemMaxFileSize, you'll find it gets translated into the "max_size" variable in the ".c" file linked above.

Since the docs didn't fully answer the question, reading the related source code may give you the fuller insight into the behavior that you were looking for.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。