]> git.proxmox.com Git - systemd.git/blame - man/systemd-journald.service.xml
Merge tag 'upstream/229'
[systemd.git] / man / systemd-journald.service.xml
CommitLineData
663996b3
MS
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
e735f4d4 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
663996b3
MS
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="systemd-journald.service">
25
e735f4d4
MP
26 <refentryinfo>
27 <title>systemd-journald.service</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd-journald.service</refentrytitle>
42 <manvolnum>8</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd-journald.service</refname>
47 <refname>systemd-journald.socket</refname>
48 <refname>systemd-journald-dev-log.socket</refname>
db2df898 49 <refname>systemd-journald-audit.socket</refname>
e735f4d4
MP
50 <refname>systemd-journald</refname>
51 <refpurpose>Journal service</refpurpose>
52 </refnamediv>
53
54 <refsynopsisdiv>
55 <para><filename>systemd-journald.service</filename></para>
56 <para><filename>systemd-journald.socket</filename></para>
57 <para><filename>systemd-journald-dev-log.socket</filename></para>
db2df898 58 <para><filename>systemd-journald-audit.socket</filename></para>
e735f4d4
MP
59 <para><filename>/usr/lib/systemd/systemd-journald</filename></para>
60 </refsynopsisdiv>
61
62 <refsect1>
63 <title>Description</title>
64
65 <para><filename>systemd-journald</filename> is a system service
66 that collects and stores logging data. It creates and maintains
67 structured, indexed journals based on logging information that is
68 received from a variety of sources:</para>
69
70 <itemizedlist>
71 <listitem><para>Kernel log messages, via kmsg</para></listitem>
72
73 <listitem><para>Simple system log messages, via the libc
74 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
75 call</para></listitem>
76
77 <listitem><para>Structured system log messages via the native
78 Journal API, see
79 <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>4</manvolnum></citerefentry></para></listitem>
80
81 <listitem><para>Standard output and standard error of system
82 services</para></listitem>
83
84 <listitem><para>Audit records, via the audit
85 subsystem</para></listitem>
86 </itemizedlist>
87
88 <para>The daemon will implicitly collect numerous metadata fields
89 for each log messages in a secure and unfakeable way. See
90 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
91 for more information about the collected metadata.
92 </para>
93
94 <para>Log data collected by the journal is primarily text-based
95 but can also include binary data where necessary. All objects
96 stored in the journal can be up to 2^64-1 bytes in size.</para>
97
98 <para>By default, the journal stores log data in
99 <filename>/run/log/journal/</filename>. Since
100 <filename>/run/</filename> is volatile, log data is lost at
101 reboot. To make the data persistent, it is sufficient to create
102 <filename>/var/log/journal/</filename> where
103 <filename>systemd-journald</filename> will then store the
6300502b
MP
104 data:</para>
105
106 <programlisting>mkdir -p /var/log/journal
107systemd-tmpfiles --create --prefix /var/log/journal</programlisting>
e735f4d4 108
e735f4d4
MP
109 <para>See
110 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
111 for information about the configuration of this service.</para>
112 </refsect1>
113
114 <refsect1>
115 <title>Signals</title>
116
117 <variablelist>
118 <varlistentry>
119 <term>SIGUSR1</term>
120
121 <listitem><para>Request that journal data from
122 <filename>/run/</filename> is flushed to
123 <filename>/var/</filename> in order to make it persistent (if
124 this is enabled). This must be used after
125 <filename>/var/</filename> is mounted, as otherwise log data
126 from <filename>/run</filename> is never flushed to
db2df898
MP
127 <filename>/var</filename> regardless of the configuration. The
128 <command>journalctl --flush</command> command uses this signal
129 to request flushing of the journal files, and then waits for
130 the operation to complete. See
131 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
132 for details.</para></listitem>
e735f4d4
MP
133 </varlistentry>
134
135 <varlistentry>
136 <term>SIGUSR2</term>
137
138 <listitem><para>Request immediate rotation of the journal
db2df898
MP
139 files. The <command>journalctl --rotate</command> command uses
140 this signal to request journal file
141 rotation.</para></listitem>
142 </varlistentry>
143
144 <varlistentry>
145 <term>SIGRTMIN+1</term>
146
147 <listitem><para>Request that all unwritten log data is written
148 to disk. The <command>journalctl --sync</command> command uses
149 this signal to trigger journal synchronization, and then waits
150 for the operation to complete.</para></listitem>
e735f4d4
MP
151 </varlistentry>
152 </variablelist>
153 </refsect1>
154
155 <refsect1>
156 <title>Kernel Command Line</title>
157
158 <para>A few configuration parameters from
159 <filename>journald.conf</filename> may be overridden on the kernel
160 command line:</para>
161
162 <variablelist class='kernel-commandline-options'>
163 <varlistentry>
164 <term><varname>systemd.journald.forward_to_syslog=</varname></term>
165 <term><varname>systemd.journald.forward_to_kmsg=</varname></term>
166 <term><varname>systemd.journald.forward_to_console=</varname></term>
167 <term><varname>systemd.journald.forward_to_wall=</varname></term>
168
169 <listitem><para>Enables/disables forwarding of collected log
170 messages to syslog, the kernel log buffer, the system console
171 or wall.
172 </para>
173
174 <para>See
175 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
176 for information about these settings.</para>
177 </listitem>
178
179 </varlistentry>
180 </variablelist>
181 </refsect1>
182
183 <refsect1>
184 <title>Access Control</title>
185
186 <para>Journal files are, by default, owned and readable by the
187 <literal>systemd-journal</literal> system group but are not
188 writable. Adding a user to this group thus enables her/him to read
189 the journal files.</para>
190
191 <para>By default, each logged in user will get her/his own set of
192 journal files in <filename>/var/log/journal/</filename>. These
193 files will not be owned by the user, however, in order to avoid
194 that the user can write to them directly. Instead, file system
195 ACLs are used to ensure the user gets read access only.</para>
196
197 <para>Additional users and groups may be granted access to journal
198 files via file system access control lists (ACL). Distributions
199 and administrators may choose to grant read access to all members
200 of the <literal>wheel</literal> and <literal>adm</literal> system
201 groups with a command such as the following:</para>
202
203 <programlisting># setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/</programlisting>
204
205 <para>Note that this command will update the ACLs both for
206 existing journal files and for future journal files created in the
207 <filename>/var/log/journal/</filename> directory.</para>
208 </refsect1>
209
210 <refsect1>
211 <title>Files</title>
212
213 <variablelist>
214 <varlistentry>
215 <term><filename>/etc/systemd/journald.conf</filename></term>
216
217 <listitem><para>Configure
218 <command>systemd-journald</command>
7035cd9e 219 behavior. See
e735f4d4
MP
220 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
221 </para></listitem>
222 </varlistentry>
223
224 <varlistentry>
225 <term><filename>/run/log/journal/<replaceable>machine-id</replaceable>/*.journal</filename></term>
226 <term><filename>/run/log/journal/<replaceable>machine-id</replaceable>/*.journal~</filename></term>
227 <term><filename>/var/log/journal/<replaceable>machine-id</replaceable>/*.journal</filename></term>
228 <term><filename>/var/log/journal/<replaceable>machine-id</replaceable>/*.journal~</filename></term>
229
230 <listitem><para><command>systemd-journald</command> writes
231 entries to files in
232 <filename>/run/log/journal/<replaceable>machine-id</replaceable>/</filename>
233 or
234 <filename>/var/log/journal/<replaceable>machine-id</replaceable>/</filename>
235 with the <literal>.journal</literal> suffix. If the daemon is
236 stopped uncleanly, or if the files are found to be corrupted,
237 they are renamed using the <literal>.journal~</literal>
238 suffix, and <command>systemd-journald</command> starts writing
239 to a new file. <filename>/run</filename> is used when
240 <filename>/var/log/journal</filename> is not available, or
241 when <option>Storage=volatile</option> is set in the
242 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
db2df898
MP
243 configuration file.</para></listitem>
244 </varlistentry>
245
246 <varlistentry>
247 <term><filename>/dev/kmsg</filename></term>
248 <term><filename>/dev/log</filename></term>
249 <term><filename>/run/systemd/journal/dev-log</filename></term>
250 <term><filename>/run/systemd/journal/socket</filename></term>
251 <term><filename>/run/systemd/journal/stdout</filename></term>
252
253 <listitem><para>Sockets and other paths that
254 <command>systemd-journald</command> will listen on that are
255 visible in the file system. In addition to these, journald can
256 listen for audit events using netlink.</para></listitem>
e735f4d4
MP
257 </varlistentry>
258 </variablelist>
259 </refsect1>
260
261 <refsect1>
262 <title>See Also</title>
263 <para>
264 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
265 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
266 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
267 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
268 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
269 <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
e3bff60a 270 <citerefentry project='die-net'><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
e735f4d4 271 <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
db2df898 272 <command>pydoc systemd.journal</command>
e735f4d4
MP
273 </para>
274 </refsect1>
663996b3
MS
275
276</refentry>