[systemd-devel] What are the use cases of journalctl --flush ?

krave1986121 at gmail.com krave1986121 at gmail.com
Wed Sep 22 06:27:02 UTC 2021


Hi, I have already read man page of journalctl and made some experiments
with the command.

All the efforts made me more confused. So, I would like to beg some help
here.

My system is Ubuntu 20.04.3 LTS.

 

My procedures:

 

1.     Create a .conf file for systemd-jounald.service with following
content:
[Journal]
Storage=volatile



2.     Restart systemd-jounald.service

sudo systemctl restart systemd-jounald.service



3.     Check the status of journald and ensure it is writing log into
memory.

systemctl status systemd-jounald.service

The result is like:

Runtime Journal (/run/log/journal/...)
which informed me that .conf file worked well.



4.     Comment out the Storage option
[Journal]
#Storage=volatile




5.     Restart journald

sudo systemctl restart system-journald



6.     check status again and you will see that flush already been done

systemctl status system-journald

with feedback including

Time spent on flushing to /var/log/journal/machineID/ is 282.991ms for 1483
entries.

which means flush had been done.

 

Now that the operation of flush can be done automatically when you switch
from Storage=volatile to #Storage=volatile, why do we still need journalctl
--flush?

 

I believe there are some reasons for the existence of this switch for
journalctl.

Hopefully, I can find some help here.

 

Thank you!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210922/0e1777e4/attachment-0001.htm>


More information about the systemd-devel mailing list