Skip to content

Commit 5d26a1a

Browse files
committed
Completed the article.
1 parent fbb2bac commit 5d26a1a

File tree

5 files changed

+108
-60
lines changed

5 files changed

+108
-60
lines changed

articles/journalctl.asm.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ xmlns="http://docbook.org/ns/docbook">
1515
<!-- R E S O U R C E S -->
1616
<resources>
1717
<!-- concepts -->
18-
<resource href="../concepts/journal-about-journald.xml" xml:id="_journal-about-journald"/>
18+
<resource href="../concepts/journal-about-journald.xml" xml:id="_journal-about-journald"/>
19+
<resource href="../concepts/journal-structure.xml" xml:id="_journal-structure"/>
20+
<resource href="../concepts/journactl-about.xml" xml:id="_journactl-about"/>
1921
<!-- glue -->
2022
<!-- tasks-->
2123
<resource href="../tasks/journald-configure.xml" xml:id="_journald-configure"/>
@@ -140,8 +142,11 @@ You must have &sudo; privileges.
140142
<module renderas="section" resourceref="_journal-about-journald">
141143
<module renderas="section" resourceref="_journald-configure"/>
142144
</module>
143-
<module renderas="section" resourceref="_journald-filter-journals"/>
145+
<module renderas="section" resourceref="_journal-structure"/>
146+
<module renderas="section" resourceref="_journactl-about">
144147
<module renderas="section" resourceref="_journalctl-usage"/>
148+
</module>
149+
<module renderas="section" resourceref="_journald-filter-journals"/>
145150

146151
<module renderas="section" resourceref="_systemd-journald-troubleshooting"/>
147152
<module resourceref="_legal"/>

concepts/journactl-about.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- This file originates from the project https://github.com/openSUSE/doc-kit -->
3+
<!-- This file can be edited downstream. -->
4+
<!DOCTYPE topic
5+
[
6+
<!ENTITY % entities SYSTEM "../common/generic-entities.ent">
7+
%entities;
8+
]>
9+
<!-- refers to legacy doc: <add github link to legacy doc piece, if applicable> -->
10+
<!-- point back to this document with a similar comment added to your legacy doc piece -->
11+
<!-- refer to README.md for file and id naming conventions -->
12+
<!-- metadata is dealt with on the assembly level -->
13+
<topic xml:id="journald-about-journactl"
14+
role="concept" xml:lang="en"
15+
xmlns="http://docbook.org/ns/docbook" version="5.2"
16+
xmlns:its="http://www.w3.org/2005/11/its"
17+
xmlns:xi="http://www.w3.org/2001/XInclude"
18+
xmlns:xlink="http://www.w3.org/1999/xlink"
19+
xmlns:trans="http://docbook.org/ns/transclusion">
20+
<info>
21+
<title>The <command>journalctl</command> command</title><!-- can be changed via merge in the assembly -->
22+
<!--add author's email address-->
23+
<meta name="maintainer" content="[email protected]" its:translate="no"/>
24+
<abstract><!-- can be changed via merge in the assembly -->
25+
<para>
26+
<command>journalctl</command> is a command-line utility used to query and display logs collected by
27+
the <command>systemd-journald</command>.
28+
</para>
29+
</abstract>
30+
</info>
31+
<para>
32+
Because the logging system stores data in a binary format (for performance and security) rather
33+
than plain text, you cannot use standard tools like <command>cat</command> or
34+
<command>less</command> to open the files directly. So the <command>journalctl</command>
35+
command decodes the data and displays it according to the provided parameters.
36+
</para>
37+
38+
</topic>

references/journalctl-usage.xml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,31 @@
2121
<title>Using <command>journalctl</command></title>
2222
<abstract>
2323
<para>
24-
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.
25+
</para>
26+
2627
</abstract>
2728
<meta name="maintainer" content="[email protected]" its:translate="no"/>
2829
</info>
29-
30-
<para>
31-
You can run the <command>journalctl</command>:
32-
</para>
33-
<section>
34-
<title>Use <command>journalctl</command></title>
35-
<para>
30+
<para>
3631
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.
3732
</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:
35+
</para>
36+
<screen>&prompt.sudo;<command>journalctl [OPTIONS...] [MATCHES...]</command></screen>
37+
<tip>
4038
<title>Messages related to a specific executable</title>
4139
<para>
4240
To show all journal messages related to a specific executable, specify the
4341
full path to the executable:
4442
</para>
4543
<screen>&prompt.sudo;journalctl /usr/lib/systemd/systemd</screen>
4644
</tip>
45+
<para>
46+
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>
4749
<variablelist>
4850
<varlistentry>
4951
<term>-f</term>
@@ -55,7 +57,7 @@
5557
</listitem>
5658
</varlistentry>
5759
<varlistentry>
58-
<term/>
60+
<term></term>
5961
<listitem>
6062
<para>
6163
Prints the messages and jumps to the end of the journal, so that the
@@ -93,6 +95,8 @@
9395
</listitem>
9496
</varlistentry>
9597
</variablelist>
96-
<para/>
97-
</section>
98+
<para>
99+
For a complete list of options refer to man page, man 1 <command>journalctl</command>.
100+
</para>
101+
98102
</topic>

tasks/journald-configure.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ TTYPath=/dev/tty12</screen>
9292
<itemizedlist>
9393
<listitem><para>Install rsyslog</para><screen>rpm -q rsyslog</screen></listitem>
9494
<listitem><para>Enable rsyslog</para><screen>systemctl is-enabled rsyslog</screen></listitem>
95-
<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>
9696
</itemizedlist>
9797
<para>For more information on file description, see <command>man 5 journald.conf</command>.</para>
9898
</listitem>

tasks/journald-filter-journals.xml

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,61 +28,62 @@ in the assembly -->
2828
</para></abstract>
2929
</info>
3030
<para>
31-
You can filter journals based on boot number, time interval, and fields.
31+
You can filter journals based on boot number, time interval, and fields. For details refer to following sections.
3232
</para>
33-
<procedure>
34-
<title>Filtering journals</title>
35-
<step><para>Filter logs based on specific system boot:</para>
36-
<itemizedlist>
37-
<listitem>
38-
<para>List all the available boots:</para>
39-
<screen>&prompt.sudo;journalctl --list-boots</screen>
40-
<para>The first column lists the boot offset: <literal>0</literal> for the current boot, <literal>-1</literal> for the previous one,
33+
<section xml:id="journal-filter-journals-boots">
34+
<title>Filter logs based on specific system boot</title>
35+
<para>
36+
To list logs for all the available boots, run the command as follows:
37+
</para>
38+
<screen>&prompt.sudo;journalctl --list-boots</screen>
39+
<para>The first column lists the boot offset: <literal>0</literal> for the current boot, <literal>-1</literal> for the previous one,
4140
<literal>-2</literal> for the one before that, etc. The second column contains the boot ID followed by the limiting time stamps of the specific
4241
boot.</para>
43-
</listitem>
44-
<listitem><para>Show all messages from the current boot:</para>
45-
<screen>&prompt.sudo;journalctl -b</screen></listitem>
46-
<listitem><para>To view journal messages from the previous boot, add an offset
42+
<para>
43+
To show all messages from the current boot:
44+
</para>
45+
<screen>&prompt.sudo;journalctl -b</screen>
46+
<para>To view journal messages from the previous boot, add an offset
4747
parameter. The following example command shows the previous boot messages:</para>
48-
<screen>&prompt.sudo;journalctl -b -1</screen></listitem>
49-
<listitem><para>To view boot messages based on the boot ID, <literal>156019a44a774a0bb0148a92df4af81b</literal>:</para>
50-
<screen>&prompt.sudo;journalctl _BOOT_ID=156019a44a774a0bb0148a92df4af81b</screen></listitem>
51-
</itemizedlist></step>
52-
<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>
50+
<screen>&prompt.sudo;journalctl _BOOT_ID=156019a44a774a0bb0148a92df4af81b</screen>
51+
</section>
52+
<section xml:id="journal-filter-journals-time">
53+
<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+
5761
<para>To view only new messages since now, and update the output continuously:</para>
58-
<screen>&prompt.sudo;journalctl --since "now" -f</screen></listitem>
59-
<listitem><para>To view all messages since last midnight till <literal>3:20am</literal>:</para>
60-
<screen>&prompt.sudo;journalctl --since "today" --until "3:20"</screen></listitem>
61-
</itemizedlist>
62-
</step>
63-
<step><para>Filter logs based on fields</para>
62+
<screen>&prompt.sudo;journalctl --since "now" -f</screen>
63+
<para>To view all messages since last midnight till <literal>3:20am</literal>:</para>
64+
<screen>&prompt.sudo;journalctl --since "today" --until "3:20"</screen>
65+
</section>
66+
<section xml:id="journal-filter-journals-fields">
67+
<title>Filtering logs based on fields</title>
68+
6469
<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
6570
as <literal>_SYSTEMD_UNIT=httpd.service</literal>. You can specify multiple matches in a single query to filter the output messages even more. See
6671
<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>
70-
<screen>&prompt.sudo;journalctl _PID=1039</screen></listitem>
71-
<listitem><para>To view messages belonging to a specific user ID, for example <literal>UID_1000</literal>:</para>
72-
<screen># journalctl _UID=1000</screen></listitem>
73-
<listitem><para>To view messages from the kernel ring buffer (the same as <command>dmesg</command> displays):</para>
74-
<screen>&prompt.sudo;journalctl _TRANSPORT=kernel</screen></listitem>
75-
<listitem><para>To view messages from the service's standard or error output:</para>
76-
<screen>&prompt.sudo;journalctl _TRANSPORT=stdout</screen></listitem>
77-
<listitem><para>To view messages produced by a specified service only:</para>
72+
73+
<para>To view messages produced by a specific process ID: <literal>PID_1039</literal>:</para>
74+
<screen>&prompt.sudo;journalctl _PID=1039</screen><para>To view messages belonging to a specific user ID: <literal>UID_1000</literal>:</para>
75+
<screen>&prompt.sudo; journalctl _UID=1000</screen>
76+
<para>To view messages from the kernel ring buffer (the same as <command>dmesg</command> displays):</para>
77+
<screen>&prompt.sudo;journalctl _TRANSPORT=kernel</screen>
78+
<para>To view messages from the service's standard or error output:</para>
79+
<screen>&prompt.sudo;journalctl _TRANSPORT=stdout</screen>
80+
<para>To view messages produced by a specified service only:</para>
7881
<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service</screen>
7982
<para>If two different fields are specified, only entries that match both expressions at the same time are shown:</para>
8083
<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1488</screen>
8184
<para>If two matches refer to the same field, all entries matching either expression are shown:</para>
8285
<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</screen>
8386
<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>
84-
<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1480 + _SYSTEMD_UNIT=dbus.service</screen></listitem>
85-
</itemizedlist>
86-
</step>
87-
</procedure>
87+
<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1480 + _SYSTEMD_UNIT=dbus.service</screen>
88+
</section>
8889
</topic>

0 commit comments

Comments
 (0)