1SYSTEMD-JOURNALD.SERVICE(8)systemd-journald.serviceSYSTEMD-JOURNALD.SERVICE(8)
2
3
4

NAME

6       systemd-journald.service, systemd-journald.socket, systemd-journald-
7       dev-log.socket, systemd-journald-audit.socket, systemd-journald -
8       Journal service
9

SYNOPSIS

11       systemd-journald.service
12
13       systemd-journald.socket
14
15       systemd-journald-dev-log.socket
16
17       systemd-journald-audit.socket
18
19       /usr/lib/systemd/systemd-journald
20

DESCRIPTION

22       systemd-journald is a system service that collects and stores logging
23       data. It creates and maintains structured, indexed journals based on
24       logging information that is received from a variety of sources:
25
26       ·   Kernel log messages, via kmsg
27
28       ·   Simple system log messages, via the libc syslog(3) call
29
30       ·   Structured system log messages via the native Journal API, see
31           sd_journal_print(3)
32
33       ·   Standard output and standard error of service units. For further
34           details see below.
35
36       ·   Audit records, originating from the kernel audit subsystem
37
38       The daemon will implicitly collect numerous metadata fields for each
39       log messages in a secure and unfakeable way. See systemd.journal-
40       fields(7) for more information about the collected metadata.
41
42       Log data collected by the journal is primarily text-based but can also
43       include binary data where necessary. Individual fields making up a log
44       record stored in the journal may be up to 2^64-1 bytes in size.
45
46       The journal service stores log data either persistently below
47       /var/log/journal or in a volatile way below /run/log/journal/ (in the
48       latter case it is lost at reboot). By default, log data is stored
49       persistently if /var/log/journal/ exists during boot, with an implicit
50       fallback to volatile storage otherwise. Use Storage= in
51       journald.conf(5) to configure where log data is placed, independently
52       of the existence of /var/log/journal/.
53
54       On systems where /var/log/journal/ does not exist yet but where
55       persistent logging is desired (and the default journald.conf is used),
56       it is sufficient to create the directory, and ensure it has the correct
57       access modes and ownership:
58
59           mkdir -p /var/log/journal
60           systemd-tmpfiles --create --prefix /var/log/journal
61
62       See journald.conf(5) for information about the configuration of this
63       service.
64

STREAM LOGGING

66       The systemd service manager invokes all service processes with standard
67       output and standard error connected to the journal by default. This
68       behaviour may be altered via the StandardOutput=/StandardError= unit
69       file settings, see systemd.exec(5) for details. The journal converts
70       the log byte stream received this way into individual log records,
71       splitting the stream at newline ("\n", ASCII 10) and NUL bytes.
72
73       If systemd-journald.service is stopped, the stream connections
74       associated with all services are terminated. Further writes to those
75       streams by the service will result in EPIPE errors. In order to react
76       gracefully in this case it is recommended that programs logging to
77       standard output/error ignore such errors. If the SIGPIPE UNIX signal
78       handler is not blocked or turned off, such write attempts will also
79       result in such process signals being generated, see signal(7). To
80       mitigate this issue, systemd service manager explicitly turns off the
81       SIGPIPE signal for all invoked processes by default (this may be
82       changed for each unit individually via the IgnoreSIGPIPE= option, see
83       systemd.exec(5) for details). After the standard output/standard error
84       streams have been terminated they may not be recovered until the
85       services they are associated with are restarted. Note that during
86       normal operation, systemd-journald.service stores copies of the file
87       descriptors for those streams in the service manager. If
88       systemd-journald.service is restarted using systemctl restart or
89       equivalent operation instead of a pair of separate systemctl stop and
90       systemctl start commands (or equivalent operations), these stream
91       connections are not terminated and survive the restart. It is thus safe
92       to restart systemd-journald.service, but stopping it is not
93       recommended.
94
95       Note that the log record metadata for records transferred via such
96       standard output/error streams reflect the metadata of the peer the
97       stream was originally created for. If the stream connection is passed
98       on to other processes (such as further child processes forked off the
99       main service process), the log records will not reflect their metadata,
100       but will continue to describe the original process. This is different
101       from the other logging transports listed above, which are inherently
102       record based and where the metadata is always associated with the
103       individual record.
104
105       In addition to the implicit standard output/error logging of services,
106       stream logging is also available via the systemd-cat(1) command line
107       tool.
108
109       Currently, the number of parallel log streams systemd-journald will
110       accept is limited to 4096. When this limit is reached further log
111       streams may be established but will receive EPIPE right from the
112       beginning.
113

SIGNALS

115       SIGUSR1
116           Request that journal data from /run/ is flushed to /var/ in order
117           to make it persistent (if this is enabled). This must be used after
118           /var/ is mounted, as otherwise log data from /run is never flushed
119           to /var regardless of the configuration. The journalctl --flush
120           command uses this signal to request flushing of the journal files,
121           and then waits for the operation to complete. See journalctl(1) for
122           details.
123
124       SIGUSR2
125           Request immediate rotation of the journal files. The journalctl
126           --rotate command uses this signal to request journal file rotation.
127
128       SIGRTMIN+1
129           Request that all unwritten log data is written to disk. The
130           journalctl --sync command uses this signal to trigger journal
131           synchronization, and then waits for the operation to complete.
132

KERNEL COMMAND LINE

134       A few configuration parameters from journald.conf may be overridden on
135       the kernel command line:
136
137       systemd.journald.forward_to_syslog=, systemd.journald.forward_to_kmsg=,
138       systemd.journald.forward_to_console=, systemd.journald.forward_to_wall=
139           Enables/disables forwarding of collected log messages to syslog,
140           the kernel log buffer, the system console or wall.
141
142           See journald.conf(5) for information about these settings.
143

ACCESS CONTROL

145       Journal files are, by default, owned and readable by the
146       "systemd-journal" system group but are not writable. Adding a user to
147       this group thus enables them to read the journal files.
148
149       By default, each logged in user will get their own set of journal files
150       in /var/log/journal/. These files will not be owned by the user,
151       however, in order to avoid that the user can write to them directly.
152       Instead, file system ACLs are used to ensure the user gets read access
153       only.
154
155       Additional users and groups may be granted access to journal files via
156       file system access control lists (ACL). Distributions and
157       administrators may choose to grant read access to all members of the
158       "wheel" and "adm" system groups with a command such as the following:
159
160           # setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/
161
162       Note that this command will update the ACLs both for existing journal
163       files and for future journal files created in the /var/log/journal/
164       directory.
165

FILES

167       /etc/systemd/journald.conf
168           Configure systemd-journald behavior. See journald.conf(5).
169
170       /run/log/journal/machine-id/*.journal,
171       /run/log/journal/machine-id/*.journal~,
172       /var/log/journal/machine-id/*.journal,
173       /var/log/journal/machine-id/*.journal~
174           systemd-journald writes entries to files in
175           /run/log/journal/machine-id/ or /var/log/journal/machine-id/ with
176           the ".journal" suffix. If the daemon is stopped uncleanly, or if
177           the files are found to be corrupted, they are renamed using the
178           ".journal~" suffix, and systemd-journald starts writing to a new
179           file.  /run is used when /var/log/journal is not available, or when
180           Storage=volatile is set in the journald.conf(5) configuration file.
181
182           When systemd-journald ceases writing to a journal file, it will be
183           renamed to "original-name@suffix.journal" (or
184           "original-name@suffix.journal~"). Such files are "archived" and
185           will not be written to any more.
186
187           In general, it is safe to read or copy any journal file (active or
188           archived).  journalctl(1) and the functions in the sd-journal(3)
189           library should be able to read all entries that have been fully
190           written.
191
192           systemd-journald will automatically remove the oldest archived
193           journal files to limit disk use. See SystemMaxUse= and related
194           settings in journald.conf(5).
195
196       /dev/kmsg, /dev/log, /run/systemd/journal/dev-log,
197       /run/systemd/journal/socket, /run/systemd/journal/stdout
198           Sockets and other paths that systemd-journald will listen on that
199           are visible in the file system. In addition to these, journald can
200           listen for audit events using netlink.
201

SEE ALSO

203       systemd(1), journalctl(1), journald.conf(5), systemd.journal-fields(7),
204       sd-journal(3), systemd-coredump(8), setfacl(1), sd_journal_print(3),
205       pydoc systemd.journal
206
207
208
209systemd 241                                        SYSTEMD-JOURNALD.SERVICE(8)
Impressum