1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
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.
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.
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/>.
24 <refentry id=
"systemd-journald.service">
27 <title>systemd-journald.service
</title>
28 <productname>systemd
</productname>
32 <contrib>Developer
</contrib>
33 <firstname>Lennart
</firstname>
34 <surname>Poettering
</surname>
35 <email>lennart@poettering.net
</email>
41 <refentrytitle>systemd-journald.service
</refentrytitle>
42 <manvolnum>8</manvolnum>
46 <refname>systemd-journald.service
</refname>
47 <refname>systemd-journald.socket
</refname>
48 <refname>systemd-journald-dev-log.socket
</refname>
49 <refname>systemd-journald-audit.socket
</refname>
50 <refname>systemd-journald
</refname>
51 <refpurpose>Journal service
</refpurpose>
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>
58 <para><filename>systemd-journald-audit.socket
</filename></para>
59 <para><filename>/usr/lib/systemd/systemd-journald
</filename></para>
63 <title>Description
</title>
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>
71 <listitem><para>Kernel log messages, via kmsg
</para></listitem>
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>
77 <listitem><para>Structured system log messages via the native
79 <citerefentry><refentrytitle>sd_journal_print
</refentrytitle><manvolnum>4</manvolnum></citerefentry></para></listitem>
81 <listitem><para>Standard output and standard error of system
82 services
</para></listitem>
84 <listitem><para>Audit records, via the audit
85 subsystem
</para></listitem>
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.
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>
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
106 <programlisting>mkdir -p /var/log/journal
107 systemd-tmpfiles --create --prefix /var/log/journal
</programlisting>
109 <para><filename>systemd-journald
</filename> will forward all
110 received log messages to the
111 <constant>AF_UNIX
</constant>/
<constant>SOCK_DGRAM
</constant>
112 socket
<filename>/run/systemd/journal/syslog
</filename>, if it
113 exists, which may be used by Unix syslog daemons to process the
117 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
118 for information about the configuration of this service.
</para>
122 <title>Signals
</title>
128 <listitem><para>Request that journal data from
129 <filename>/run/
</filename> is flushed to
130 <filename>/var/
</filename> in order to make it persistent (if
131 this is enabled). This must be used after
132 <filename>/var/
</filename> is mounted, as otherwise log data
133 from
<filename>/run
</filename> is never flushed to
134 <filename>/var
</filename> regardless of the
135 configuration.
</para></listitem>
141 <listitem><para>Request immediate rotation of the journal
142 files.
</para></listitem>
148 <title>Kernel Command Line
</title>
150 <para>A few configuration parameters from
151 <filename>journald.conf
</filename> may be overridden on the kernel
154 <variablelist class='kernel-commandline-options'
>
156 <term><varname>systemd.journald.forward_to_syslog=
</varname></term>
157 <term><varname>systemd.journald.forward_to_kmsg=
</varname></term>
158 <term><varname>systemd.journald.forward_to_console=
</varname></term>
159 <term><varname>systemd.journald.forward_to_wall=
</varname></term>
161 <listitem><para>Enables/disables forwarding of collected log
162 messages to syslog, the kernel log buffer, the system console
167 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
168 for information about these settings.
</para>
176 <title>Access Control
</title>
178 <para>Journal files are, by default, owned and readable by the
179 <literal>systemd-journal
</literal> system group but are not
180 writable. Adding a user to this group thus enables her/him to read
181 the journal files.
</para>
183 <para>By default, each logged in user will get her/his own set of
184 journal files in
<filename>/var/log/journal/
</filename>. These
185 files will not be owned by the user, however, in order to avoid
186 that the user can write to them directly. Instead, file system
187 ACLs are used to ensure the user gets read access only.
</para>
189 <para>Additional users and groups may be granted access to journal
190 files via file system access control lists (ACL). Distributions
191 and administrators may choose to grant read access to all members
192 of the
<literal>wheel
</literal> and
<literal>adm
</literal> system
193 groups with a command such as the following:
</para>
195 <programlisting># setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/
</programlisting>
197 <para>Note that this command will update the ACLs both for
198 existing journal files and for future journal files created in the
199 <filename>/var/log/journal/
</filename> directory.
</para>
207 <term><filename>/etc/systemd/journald.conf
</filename></term>
209 <listitem><para>Configure
210 <command>systemd-journald
</command>
212 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
217 <term><filename>/run/log/journal/
<replaceable>machine-id
</replaceable>/*.journal
</filename></term>
218 <term><filename>/run/log/journal/
<replaceable>machine-id
</replaceable>/*.journal~
</filename></term>
219 <term><filename>/var/log/journal/
<replaceable>machine-id
</replaceable>/*.journal
</filename></term>
220 <term><filename>/var/log/journal/
<replaceable>machine-id
</replaceable>/*.journal~
</filename></term>
222 <listitem><para><command>systemd-journald
</command> writes
224 <filename>/run/log/journal/
<replaceable>machine-id
</replaceable>/
</filename>
226 <filename>/var/log/journal/
<replaceable>machine-id
</replaceable>/
</filename>
227 with the
<literal>.journal
</literal> suffix. If the daemon is
228 stopped uncleanly, or if the files are found to be corrupted,
229 they are renamed using the
<literal>.journal~
</literal>
230 suffix, and
<command>systemd-journald
</command> starts writing
231 to a new file.
<filename>/run
</filename> is used when
232 <filename>/var/log/journal
</filename> is not available, or
233 when
<option>Storage=volatile
</option> is set in the
234 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
235 configuration file.
</para></listitem>
239 <term><filename>/dev/kmsg
</filename></term>
240 <term><filename>/dev/log
</filename></term>
241 <term><filename>/run/systemd/journal/dev-log
</filename></term>
242 <term><filename>/run/systemd/journal/socket
</filename></term>
243 <term><filename>/run/systemd/journal/stdout
</filename></term>
245 <listitem><para>Sockets and other paths that
246 <command>systemd-journald
</command> will listen on that are
247 visible in the file system. In addition to these, journald can
248 listen for audit events using netlink.
</para></listitem>
254 <title>See Also
</title>
256 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
257 <citerefentry><refentrytitle>journalctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
258 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
259 <citerefentry><refentrytitle>systemd.journal-fields
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
260 <citerefentry><refentrytitle>sd-journal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
261 <citerefentry><refentrytitle>systemd-coredump
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
262 <citerefentry project='die-net'
><refentrytitle>setfacl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
263 <citerefentry><refentrytitle>sd_journal_print
</refentrytitle><manvolnum>4</manvolnum></citerefentry>,
264 <command>pydoc systemd.journal
</command>.