You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the <command>journalctl</command> without any options displays all logged messages, usually starting from the oldest, and pipes the output through a pager (like less) for easy navigation.
25
-
</para>
24
+
This section describes the generic usage of the <command>journalctl</command> command.
Running the <command>journalctl</command> without any options displays all logged messages, usually starting from the oldest, and pipes the output through a pager (like less) for easy navigation.
37
32
</para>
38
-
<para>Listed below are the common useful options to enhance the default <command>journalctl</command> behavior. All switches are described in the <command>journalctl</command> man page, man 1 <command>journalctl</command>. </para>
39
-
<tip>
33
+
<para>
34
+
The general syntax of the <command>journalctl</command> command is as follows:
Running the command without any options displays all logged messages, usually starting from the oldest, and pipes the output through a pager (like <command>less</command>) for easy navigation.
47
+
</para>
48
+
<para>Listed below are the common useful options to enhance the default <command>journalctl</command> behavior:</para>
47
49
<variablelist>
48
50
<varlistentry>
49
51
<term>-f</term>
@@ -55,7 +57,7 @@
55
57
</listitem>
56
58
</varlistentry>
57
59
<varlistentry>
58
-
<term/>
60
+
<term></term>
59
61
<listitem>
60
62
<para>
61
63
Prints the messages and jumps to the end of the journal, so that the
@@ -93,6 +95,8 @@
93
95
</listitem>
94
96
</varlistentry>
95
97
</variablelist>
96
-
<para/>
97
-
</section>
98
+
<para>
99
+
For a complete list of options refer to man page, man 1 <command>journalctl</command>.
<listitem><para>Enable forwarding to rsyslog in in <filename>/etc/systemd/journald.conf</filename></para><screen>ForwardToSyslog=yes</screen></listitem>
95
+
<listitem><para>Enable forwarding to rsyslog in <filename>/etc/systemd/journald.conf</filename></para><screen>ForwardToSyslog=yes</screen></listitem>
96
96
</itemizedlist>
97
97
<para>For more information on file description, see <command>man 5 journald.conf</command>.</para>
<step><para>Filter logs based on time interval</para>
53
-
<para>You can filter the output of <command>journalctl</command> by specifying the starting and/or ending date. The date specification should be of the format<literal>YYYY-MM-DD H:MM:SS</literal>. If the time part is omitted, midnight is assumed. If seconds are omitted, <literal>:00</literal> is assumed. If the date part is omitted, the current day is assumed. Instead of numeric expression, you can specify the keywords <literal>yesterday</literal>,
54
-
<literal>today</literal> or <literal>tomorrow</literal>. They refer to midnight of the day before the current day, of the current day, or of the day after the current day. If you specify <literal>now</literal>, it refers to the current time. You can also specify relative times prefixed with <literal>-</literal> or <literal>+</literal>, referring to times before or after the current time.</para>
55
-
<itemizedlist>
56
-
<listitem>
48
+
<screen>&prompt.sudo;journalctl -b -1</screen>
49
+
<para>To view boot messages based on the boot ID, <literal>156019a44a774a0bb0148a92df4af81b</literal>:</para>
<title>Filtering logs based on time interval</title>
54
+
<para>You can filter the output of <command>journalctl</command> by specifying the starting and/or ending date. The date specification should be of the format<literal>YYYY-MM-DD H:MM:SS</literal>. If the time part is omitted, midnight is assumed. If seconds are omitted, <literal>:00</literal> is assumed. If the date part is omitted, the current day is assumed. Instead of numeric expression, you can specify the keywords <literal>yesterday</literal>,
55
+
<literal>today</literal> or <literal>tomorrow</literal>. They refer to midnight of the day
56
+
before the current day, of the current day, or of the day after the current day. If you specify
57
+
<literal>now</literal>, it refers to the current time. You can also specify relative times
58
+
prefixed with <literal>-</literal> or <literal>+</literal>, referring to times before or after
59
+
the current time.</para>
60
+
57
61
<para>To view only new messages since now, and update the output continuously:</para>
<para>You can filter the output of the journal by specific fields. The syntax of a field to be matched is <literal>FIELD_NAME=MATCHED_VALUE</literal>, such
65
70
as <literal>_SYSTEMD_UNIT=httpd.service</literal>. You can specify multiple matches in a single query to filter the output messages even more. See
66
71
<command>man 7 systemd.journal-fields</command> for a list of default fields.</para>
67
-
<itemizedlist>
68
-
<listitem>
69
-
<para>To view messages produced by a specific process ID, for example <literal>PID_1039</literal>:</para>
<para>You can use the <literal>+</literal> separator to combine two expressions in a logical <literal>OR</literal>. The following example shows all messages from the Avahi service process with the process ID 1480 together with all messages from the D-Bus service:</para>
0 commit comments