|
25 | 25 | <para><command>journalctl</command> is the command-line tool to view and analyze the logs from the <command>systemd-journald</command> service.</para></abstract> |
26 | 26 |
|
27 | 27 | </info> |
28 | | - <section xml:id="sec-journalctl-managing"> |
29 | | - <title><command>journalctl</command>: configuration and structure</title> |
30 | | - |
| 28 | + <section><title>Understanding <command>journalctl</command> configuration and structure</title> |
31 | 29 | <para> |
32 | 30 | This section describes the <command>journalctl</command> location, configuring the location for persistent logs, and the <command>journalctl</command> entry structure. |
33 | 31 | </para> |
|
69 | 67 | </listitem> |
70 | 68 | </itemizedlist> |
71 | 69 | </section> |
72 | | -<section xml:id="sec-journalctl-filter"> |
73 | | - <title>Filtering the journal output</title> |
74 | | - |
75 | | - <para> |
76 | | - This section describes how to refine the search in logs according to boot numbers, for specific time interval or to view specific data fields. |
77 | | - content of the journal, the oldest entries listed first. The output can be |
78 | | - filtered by specific switches and fields. |
79 | | - </para> |
80 | | - <section xml:id="sec-journalctl-filter-boot"> |
81 | | - <title>Filtering based on a boot number</title> |
82 | | - <para> |
83 | | - <command>journalctl</command> can filter messages based on a specific |
84 | | - system boot. To list all available boots, run |
85 | | - </para> |
86 | | -<screen>&prompt.sudo;journalctl --list-boots</screen> |
87 | | - <para> |
88 | | - The first column lists the boot offset: <literal>0</literal> for the |
89 | | - current boot, <literal>-1</literal> for the previous one, |
90 | | - <literal>-2</literal> for the one before that, etc. The second column |
91 | | - contains the boot ID followed by the limiting time stamps of the specific |
92 | | - boot. |
93 | | - </para> |
94 | | - <para> |
95 | | - Show all messages from the current boot: |
96 | | - </para> |
97 | | -<screen>&prompt.sudo;journalctl -b</screen> |
98 | | - <para> |
99 | | - If you need to see journal messages from the previous boot, add an offset |
100 | | - parameter. The following example outputs the previous boot messages: |
101 | | - </para> |
102 | | -<screen>&prompt.sudo;journalctl -b -1</screen> |
103 | | - <para> |
104 | | - Another way is to list boot messages based on the boot ID. For this |
105 | | - purpose, use the _BOOT_ID field: |
106 | | - </para> |
107 | | -<screen>&prompt.sudo;journalctl _BOOT_ID=156019a44a774a0bb0148a92df4af81b</screen> |
108 | | - </section> |
109 | | - |
110 | | - <section xml:id="sec-journalctl-filter-time"> |
111 | | - <title>Filtering based on time interval</title> |
112 | | - <para> |
113 | | - You can filter the output of <command>journalctl</command> by specifying the |
114 | | - starting and/or ending date. The date specification should be of the format |
115 | | - <literal>2025-06-30 9:17:16</literal>. If the time part is omitted, midnight |
116 | | - is assumed. If seconds are omitted, <literal>:00</literal> is assumed. If |
117 | | - the date part is omitted, the current day is assumed. Instead of numeric |
118 | | - expression, you can specify the keywords <literal>yesterday</literal>, |
119 | | - <literal>today</literal> or <literal>tomorrow</literal>. They refer to |
120 | | - midnight of the day before the current day, of the current day, or of the |
121 | | - day after the current day. If you specify <literal>now</literal>, it refers |
122 | | - to the current time. You can also specify relative times prefixed with |
123 | | - <literal>-</literal> or <literal>+</literal>, referring to times before or |
124 | | - after the current time. |
125 | | - </para> |
126 | | - <para> |
127 | | - Show only new messages since now, and update the output continuously: |
128 | | - </para> |
129 | | -<screen>&prompt.sudo;journalctl --since "now" -f</screen> |
130 | | - <para> |
131 | | - Show all messages since last midnight till 3:20am: |
132 | | - </para> |
133 | | -<screen>&prompt.sudo;journalctl --since "today" --until "3:20"</screen> |
134 | | - </section> |
135 | | - <section xml:id="sec-journalctl-filter-fields"> |
136 | | - <title>Filtering based on fields</title> |
137 | | - <para> |
138 | | - You can filter the output of the journal by specific fields. The syntax of |
139 | | - a field to be matched is <literal>FIELD_NAME=MATCHED_VALUE</literal>, such |
140 | | - as <literal>_SYSTEMD_UNIT=httpd.service</literal>. You can specify multiple |
141 | | - matches in a single query to filter the output messages even more. See |
142 | | - <command>man 7 systemd.journal-fields</command> for a list of default |
143 | | - fields. |
144 | | - </para> |
145 | | - <para> |
146 | | - Show messages produced by a specific process ID: |
147 | | - </para> |
148 | | -<screen>&prompt.sudo;journalctl _PID=1039</screen> |
149 | | - <para> |
150 | | - Show messages belonging to a specific user ID: |
151 | | - </para> |
152 | | -<screen># journalctl _UID=1000</screen> |
153 | | - <para> |
154 | | - Show messages from the kernel ring buffer (the same as |
155 | | - <command>dmesg</command> displays): |
156 | | - </para> |
157 | | -<screen>&prompt.sudo;journalctl _TRANSPORT=kernel</screen> |
158 | | - <para> |
159 | | - Show messages from the service's standard or error output: |
160 | | - </para> |
161 | | -<screen>&prompt.sudo;journalctl _TRANSPORT=stdout</screen> |
162 | | - <para> |
163 | | - Show messages produced by a specified service only: |
164 | | - </para> |
165 | | -<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service</screen> |
166 | | - <para> |
167 | | - If two different fields are specified, only entries that match both |
168 | | - expressions at the same time are shown: |
169 | | - </para> |
170 | | -<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1488</screen> |
171 | | - <para> |
172 | | - If two matches refer to the same field, all entries matching either |
173 | | - expression are shown: |
174 | | - </para> |
175 | | -<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</screen> |
176 | | - <para> |
177 | | - You can use the <literal>+</literal> separator to combine two expressions in |
178 | | - a logical <literal>OR</literal>. The following example shows all messages |
179 | | - from the Avahi service process with the process ID 1480 together with all |
180 | | - messages from the D-Bus service: |
181 | | - </para> |
182 | | -<screen>&prompt.sudo;journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1480 + _SYSTEMD_UNIT=dbus.service</screen> |
183 | | - </section> |
184 | | -</section> |
185 | 70 | </topic> |
0 commit comments