Difference between revisions of "Journal Control"

From 6bit.ch wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
= journalctl =
= journalctl =


May be used to query the contents of the systemd(1) journal as written by systemd-journald.service(8).</br>
May be used to query the contents of the systemd journal as written by systemd-journald.service.</br>


== Use ==
== Use ==
<code>journalctl -xe</code> show last 1000 messages in a pager</br>
<code>journalctl -xeb</code> show latest messages with explanation since last boot</br>
<code>journalctl -f</code> follow latest messages</br>
<code>journalctl -t <service></code> show messages of a particular <service> only</br>
<code>journalctl -t sshd</code> show messages of a particular service</br>
<code>journalctl -p <priority></code> show messages with particular <priority> and above only</br>
 
== Time ==
<code>journalctl -b </code> show messages from current boot</br>
<code>journalctl -S "1969-04-20 16:13:12"</code> show messages since (not older than) <date></br>
<code>journalctl -U "1969-04-20 16:13:12"</code> show messages until (not newer than) <date></br>
 
=== Relative Time ===
<code>journalctl -S today</code> show today's messages, from midnight until now</br>
<code>journalctl -S yesterday</code> show yesterday's messages, up until midnight</br>
<code>journalctl -S -1m</code> show most recent messages not older than 1 minute</br>
<code>journalctl -S -1h</code> show most recent messages not older than 1 hour</br>
<code>journalctl -S -1d</code> show most recent messages not older than 1 day</br>
<code>journalctl -S -1w</code> show most recent messages not older than 1 week</br>
</br>
</br>


== Useful Flags ==
== Useful Flags ==
<code>-p <priority></code> show messages with $priority and above only</br>
<code>-e</code> jump to the end</br>
<code>-b <priority></code> show messages since last boot only</br>
<code>-f</code> follow latest messages</br>
<code>-b</code> show messages since last boot only</br>
<code>-x</code> show explanations</br>
</br>
<code>--list-boots</code> show boot list</br>
<code>--disk-usage</code> show journal disk use</br>
<code>--vaccuum-size=100M</code> set log retention to size</br>
<code>--vaccuum-time=1weeks</code> set log retention to time</br>
</br>

Latest revision as of 11:00, 21 August 2023

journalctl

May be used to query the contents of the systemd journal as written by systemd-journald.service.

Use

journalctl -xeb show latest messages with explanation since last boot
journalctl -t <service> show messages of a particular <service> only
journalctl -p <priority> show messages with particular <priority> and above only

Time

journalctl -b show messages from current boot
journalctl -S "1969-04-20 16:13:12" show messages since (not older than) <date>
journalctl -U "1969-04-20 16:13:12" show messages until (not newer than) <date>

Relative Time

journalctl -S today show today's messages, from midnight until now
journalctl -S yesterday show yesterday's messages, up until midnight
journalctl -S -1m show most recent messages not older than 1 minute
journalctl -S -1h show most recent messages not older than 1 hour
journalctl -S -1d show most recent messages not older than 1 day
journalctl -S -1w show most recent messages not older than 1 week

Useful Flags

-e jump to the end
-f follow latest messages
-b show messages since last boot only
-x show explanations

--list-boots show boot list
--disk-usage show journal disk use
--vaccuum-size=100M set log retention to size
--vaccuum-time=1weeks set log retention to time