1 <?xml version='
1.0'
?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2012 Zbigniew Jędrzejewski-Szmek
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"systemd-journal-remote" conditional='HAVE_MICROHTTPD'
27 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
30 <title>systemd-journal-remote
</title>
31 <productname>systemd
</productname>
35 <contrib>Developer
</contrib>
36 <firstname>Zbigniew
</firstname>
37 <surname>Jędrzejewski-Szmek
</surname>
38 <email>zbyszek@in.waw.pl
</email>
44 <refentrytitle>systemd-journal-remote
</refentrytitle>
45 <manvolnum>8</manvolnum>
49 <refname>systemd-journal-remote
</refname>
50 <refpurpose>Receive journal messages over the network
</refpurpose>
55 <command>systemd-journal-remote
</command>
56 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
57 <arg choice=
"opt" rep=
"norepeat">-o/--output=
<replaceable>DIR
</replaceable>|
<replaceable>FILE
</replaceable></arg>
58 <arg choice=
"opt" rep=
"repeat">SOURCES
</arg>
63 <title>Description
</title>
66 <filename>systemd-journal-remote
</filename> is a command to
67 receive serialized journal events and store them to the journal.
68 Input streams are in the
69 <ulink url=
"https://www.freedesktop.org/wiki/Software/systemd/export">
72 i.e. like the output from
73 <command>journalctl --output=export
</command>. For transport over
74 the network, this serialized stream is usually carried over an
80 <title>Sources
</title>
83 Sources can be either
"active"
84 (
<command>systemd-journal-remote
</command> requests and pulls
85 the data), or
"passive"
86 (
<command>systemd-journal-remote
</command> waits for a
87 connection and then receives events pushed by the other side).
91 <command>systemd-journal-remote
</command> can read more than one
92 event stream at a time. They will be interleaved in the output
93 file. In case of
"active" connections, each
"source" is one
94 stream, and in case of
"passive" connections, each connection can
95 result in a separate stream. Sockets can be configured in
96 "accept" mode (i.e. only one connection), or
"listen" mode (i.e.
97 multiple connections, each resulting in a stream).
101 When there are no more connections, and no more can be created
102 (there are no listening sockets), then
103 <command>systemd-journal-remote
</command> will exit.
106 <para>Active sources can be specified in the following
111 <term><arg choice=
"opt" rep=
"repeat">SOURCES
</arg></term>
113 <listitem><para>When
<option>-
</option> is given as a
114 positional argument, events will be read from standard input.
115 Other positional arguments will be treated as filenames
116 to open and read from.
</para></listitem>
120 <term><option>--url=
<replaceable>ADDRESS
</replaceable></option></term>
122 <listitem><para>With the
123 <option>--url=
<replaceable>ADDRESS
</replaceable></option> option,
124 events will be retrieved using HTTP from
125 <replaceable>ADDRESS
</replaceable>. This URL should refer to the
127 <citerefentry><refentrytitle>systemd-journal-gatewayd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
128 instance, e.g. http://some.host:
19531/ or
129 https://some.host:
19531/.
</para></listitem>
133 <term><option>--getter='
<replaceable>PROG
</replaceable> <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>'
</option></term>
135 <listitem><para>Program to invoke to retrieve data. The journal
136 event stream must be generated on standard output.
</para>
138 <para>Examples:
</para>
140 <programlisting>--getter='curl
"-HAccept: application/vnd.fdo.journal" https://some.host:
19531/'
</programlisting>
142 <programlisting>--getter='wget
--header=
"Accept: application/vnd.fdo.journal" -O- https://some.host:
19531/'
</programlisting>
147 <para>Passive sources can be specified in the following
152 <term><option>--listen-raw=
<replaceable>ADDRESS
</replaceable></option></term>
154 <listitem><para><replaceable>ADDRESS
</replaceable> must be an
155 address suitable for
<option>ListenStream=
</option> (cf.
156 <citerefentry><refentrytitle>systemd.socket
</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
157 <command>systemd-journal-remote
</command> will listen on this
158 socket for connections. Each connection is expected to be a
159 stream of journal events.
</para>
164 <term><option>--listen-http=
<replaceable>ADDRESS
</replaceable></option></term>
165 <term><option>--listen-https=
<replaceable>ADDRESS
</replaceable></option></term>
167 <listitem><para><replaceable>ADDRESS
</replaceable> must be
168 either a negative integer, in which case it will be
169 interpreted as the (negated) file descriptor number, or an
170 address suitable for
<option>ListenStream=
</option> (c.f.
171 <citerefentry><refentrytitle>systemd.socket
</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
172 In the first case, matching file descriptor must be inherited
174 <varname>$LISTEN_FDS
</varname>/
<varname>$LISTEN_PID
</varname>.
175 In the second case, an HTTP or HTTPS server will be spawned on
176 this port, respectively for
<option>--listen-http
</option> and
177 <option>--listen-https
</option>. Currently, only POST requests
178 to
<filename>/upload
</filename> with
<literal>Content-Type:
179 application/vnd.fdo.journal
</literal> are supported.
</para>
184 <term><varname>$LISTEN_FDS
</varname></term>
186 <listitem><para><command>systemd-journal-remote
</command>
188 <varname>$LISTEN_FDS
</varname>/
<varname>$LISTEN_PID
</varname>
189 protocol. Open sockets inherited through socket activation
190 behave like those opened with
<option>--listen-raw=
</option>
191 described above, unless they are specified as an argument in
192 <option>--listen-http=-
<replaceable>n
</replaceable></option>
194 <option>--listen-https=-
<replaceable>n
</replaceable></option>
195 above. In the latter case, an HTTP or HTTPS server will be
196 spawned using this descriptor and connections must be made
197 over the HTTP protocol.
</para>
207 <para>The location of the output journal can be specified
208 with
<option>-o
</option> or
<option>--output=
</option>.
213 <term><option>--output=
<replaceable>FILE
</replaceable></option></term>
215 <listitem><para>Will write to this journal file. The filename
216 must end with
<filename>.journal
</filename>. The file will be
217 created if it does not exist. If necessary (journal file full,
218 or corrupted), the file will be renamed following normal
219 journald rules and a new journal file will be created in its
220 stead.
</para></listitem>
224 <term><option>--output=
<replaceable>DIR
</replaceable></option></term>
226 <listitem><para>Will create journal files underneath directory
227 <replaceable>DIR
</replaceable>. The directory must exist. If
228 necessary (journal files over size, or corrupted), journal
229 files will be rotated following normal journald rules. Names
230 of files underneath
<replaceable>DIR
</replaceable> will be
231 generated using the rules described below.
</para></listitem>
235 <para>If
<option>--output=
</option> is not used, the output
236 directory
<filename>/var/log/journal/remote/
</filename> will be
237 used. In case the output file is not specified, journal files
238 will be created underneath the selected directory. Files will be
240 <filename>remote-
<replaceable>hostname
</replaceable>.journal
</filename>,
241 where the
<replaceable>hostname
</replaceable> part is the
242 escaped hostname of the source endpoint of the connection, or the
243 numerical address if the hostname cannot be determined.
</para>
245 <para>In the case that
"active" sources are given by the positional
246 arguments or
<option>--getter=
</option> option, the output file name
247 must always be given explicitly.
</para>
251 <title>Options
</title>
253 <para>The following options are understood:
</para>
257 <term><option>--split-mode
</option></term>
259 <listitem><para>One of
<constant>none
</constant> or
260 <constant>host
</constant>. For the first, only one output
261 journal file is used. For the latter, a separate output file
262 is used, based on the hostname of the other endpoint of a
265 <para>In the case that
"active" sources are given by the positional
266 arguments or
<option>--getter=
</option> option, the output file name must
267 always be given explicitly and only
<constant>none
</constant>
268 is allowed.
</para></listitem>
272 <term><option>--compress
</option> [
<replaceable>BOOL
</replaceable>]
</term>
274 <listitem><para>If this is set to
<literal>yes
</literal> then compress
275 the data in the journal using XZ. The default is
<literal>yes
</literal>.
280 <term><option>--seal
</option> [
<replaceable>BOOL
</replaceable>]
</term>
282 <listitem><para>If this is set to
<literal>yes
</literal> then
283 periodically sign the data in the journal using Forward Secure Sealing.
284 The default is
<literal>no
</literal>.
</para></listitem>
287 <xi:include href=
"standard-options.xml" xpointer=
"help" />
288 <xi:include href=
"standard-options.xml" xpointer=
"version" />
293 <title>Examples
</title>
294 <para>Copy local journal events to a different journal directory:
296 journalctl -o export | systemd-journal-remote -o /tmp/dir/foo.journal -
300 <para>Retrieve all available events from a remote
301 <citerefentry><refentrytitle>systemd-journal-gatewayd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
302 instance and store them in
303 <filename>/var/log/journal/remote/remote-some.host.journal
</filename>:
305 systemd-journal-remote --url http://some.host:
19531/
309 <para>Retrieve current boot events and wait for new events from a remote
310 <citerefentry><refentrytitle>systemd-journal-gatewayd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
311 instance, and store them in
312 <filename>/var/log/journal/remote/remote-some.host.journal
</filename>:
314 systemd-journal-remote --url http://some.host:
19531/entries?boot
&follow
320 <title>See Also
</title>
322 <citerefentry><refentrytitle>systemd-journal-upload
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
323 <citerefentry><refentrytitle>journalctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
324 <citerefentry><refentrytitle>systemd-journald.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
325 <citerefentry><refentrytitle>systemd-journal-gatewayd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
326 <citerefentry><refentrytitle>journal-remote.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>