[systemd-devel] Expired Message in Log

Andreas Krueger Andreas.Krueger at fmc-ag.com
Thu Jul 8 15:33:10 UTC 2021


Hi Folks,

For my customer I have to verify the logger in its system, which is journald (241). For that I have written some tests that should verify if expired messages will been thrown out of the log. As you can see, the configuration is set in that way that messages older than 12 months shall be removed.

[Journal]
Storage=persistent
Compress=yes
Seal=yes
SplitMode=none
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=500M
#SystemKeepFree=
SystemMaxFileSize=50M
SystemMaxFiles=13
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
MaxRetentionSec=12month
#MaxFileSec=1month
#ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes

The test does 5 steps:

  1.  With the help of command date the system clock is reset by 367 days, which is definitely more than 12 months, even in leap year.
  2.  Send a message to logger.
  3.  Reset system clock to current time, which was stored before step 1.
  4.  Send another message to logger.
  5.  Synchronize the logger, to be sure all data are in the file system.

What I expect to see is only the message that was sent after resetting the system clock (green text). In fact, I can see the expired message (red text) as well (today is 2021-07-08). Is this correct?

Beside this, I have observed, that modifying the time by command date will trigger a rotation. Is this observation correct?

Greeting from Berlin,
Andreas

developer at debianVM ../loggerlib/build/integration_test/test (git)-[ak/journal] % journalctl -n 400 --no-pager -o short-iso
-- Logs begin at Mon 2020-07-06 15:23:50 CEST, end at Thu 2021-07-08 16:23:48 CEST. --
2021-07-08T15:23:50+0200 debianVM systemd-journald[286]: System journal (/var/log/journal/c1223bdbe6484166aa9af858c392a7e0) is 40.0M, max 500.0M, 460.0M free.
2020-07-06T15:23:50+0200 debianVM LoggerLib_sw_integration_test[4941]: Expired Message
2021-07-08T15:23:50+0200 debianVM systemd[1]: Starting Rotate log files...
2021-07-08T15:23:50+0200 debianVM anacron[4956]: Anacron 2.3 started on 2021-07-08
2021-07-08T15:23:50+0200 debianVM systemd[1]: Starting Daily apt download activities...
2021-07-08T15:23:50+0200 debianVM anacron[4956]: Normal exit (0 jobs run)
2021-07-08T15:23:50+0200 debianVM LoggerLib_sw_integration_test[4941]: Test Message No.0
2021-07-08T15:23:50+0200 debianVM systemd[1]: Starting Daily man-db regeneration...
2021-07-08T15:23:50+0200 debianVM systemd[1]: Started Run anacron jobs.
2021-07-08T15:23:50+0200 debianVM systemd[1]: anacron.service: Succeeded.
2021-07-08T15:23:50+0200 debianVM sudo[4940]: pam_unix(sudo:session): session closed for user root
2021-07-08T15:23:50+0200 debianVM systemd[1]: logrotate.service: Succeeded.
2021-07-08T15:23:50+0200 debianVM systemd[1]: Started Rotate log files.
2021-07-08T15:23:50+0200 debianVM systemd[1]: man-db.service: Succeeded.
2021-07-08T15:23:50+0200 debianVM systemd[1]: Started Daily man-db regeneration.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210708/ad071bde/attachment.htm>


More information about the systemd-devel mailing list