On 08.07.2021 18:33, Andreas Krueger wrote:
> 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.

Forward or backward?

>   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?
> 

This is plain text mailing list. We do not see any red, green or yellow.

Settings in journald.conf apply to archived journal files only. They do
not apply to active journal file. Was journal rotated in between?

journald does not remove individual "expired" messages, it removes whole
expired journal file. For your message to be removed it must be in
archive file that had been created in the past and which is older than
expiration date. Is it the case?

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

That I cannot answer, but it sounds logical.

> 
> Greeting from Berlin,
> Andreas
> 
> developer@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.
> 
> 
> 
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to