summaryrefslogtreecommitdiffstats
path: root/man/systemd-journal-remote.service.xml
blob: c8a702ad58dae10fb170c2cbc26b3f8e8570c0cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->

<refentry id="systemd-journal-remote" conditional='HAVE_MICROHTTPD'
          xmlns:xi="http://www.w3.org/2001/XInclude">

  <refentryinfo>
    <title>systemd-journal-remote.service</title>
    <productname>systemd</productname>
  </refentryinfo>

  <refmeta>
    <refentrytitle>systemd-journal-remote.service</refentrytitle>
    <manvolnum>8</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>systemd-journal-remote.service</refname>
    <refname>systemd-journal-remote.socket</refname>
    <refname>systemd-journal-remote</refname>
    <refpurpose>Receive journal messages over the network</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <para><filename>systemd-journal-remote.service</filename></para>
    <para><filename>systemd-journal-remote.socket</filename></para>
    <cmdsynopsis>
      <command>/usr/lib/systemd/systemd-journal-remote</command>
      <arg choice="opt" rep="repeat">OPTIONS</arg>
      <arg choice="opt" rep="norepeat">-o/--output=<replaceable>DIR</replaceable>|<replaceable>FILE</replaceable></arg>
      <arg choice="opt" rep="repeat">SOURCES</arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para><command>systemd-journal-remote</command> is a command to receive serialized journal
    events and store them to journal files. Input streams are in the
    <ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>,
    i.e. like the output from <command>journalctl --output=export</command>. For transport over the
    network, this serialized stream is usually carried over an HTTPS connection.</para>

    <para><filename>systemd-journal-remote.service</filename> is a system service that uses
    <command>systemd-journal-remote</command> to listen for connections.
    <filename>systemd-journal-remote.socket</filename> configures the network address that
    <filename>systemd-journal-remote.service</filename> listens on. By default this is port 19532.
    What connections are accepted and how the received data is stored can be configured through the
    <citerefentry><refentrytitle>journal-remote.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
    configuration file.</para>
  </refsect1>

  <refsect1>
    <title>Sources</title>

    <para>
      Sources can be either "active"
      (<command>systemd-journal-remote</command> requests and pulls
      the data), or "passive"
      (<command>systemd-journal-remote</command> waits for a
      connection and then receives events pushed by the other side).
    </para>

    <para>
      <command>systemd-journal-remote</command> can read more than one
      event stream at a time. They will be interleaved in the output
      file. In case of "active" connections, each "source" is one
      stream, and in case of "passive" connections, each connection can
      result in a separate stream. Sockets can be configured in
      "accept" mode (i.e. only one connection), or "listen" mode (i.e.
      multiple connections, each resulting in a stream).
    </para>

    <para>
      When there are no more connections, and no more can be created
      (there are no listening sockets), then
      <command>systemd-journal-remote</command> will exit.
    </para>

    <para>Active sources can be specified in the following
    ways:</para>

    <variablelist>
      <varlistentry>
        <term><arg choice="opt" rep="repeat">SOURCES</arg></term>

        <listitem><para>When <option>-</option> is given as a
        positional argument, events will be read from standard input.
        Other positional arguments will be treated as filenames
        to open and read from.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--url=<replaceable>ADDRESS</replaceable></option></term>

        <listitem><para>With the
        <option>--url=<replaceable>ADDRESS</replaceable></option> option,
        events will be retrieved using HTTP from
        <replaceable>ADDRESS</replaceable>. This URL should refer to the
        root of a remote
        <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
        instance, e.g. http://some.host:19531/ or
        https://some.host:19531/.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--getter='<replaceable>PROG</replaceable> <arg choice="opt" rep="repeat">OPTIONS</arg>'</option></term>

        <listitem><para>Program to invoke to retrieve data. The journal
        event stream must be generated on standard output.</para>

        <para>Examples:</para>

        <programlisting>--getter='curl "-HAccept: application/vnd.fdo.journal" https://some.host:19531/'</programlisting>

        <programlisting>--getter='wget --header="Accept: application/vnd.fdo.journal" -O- https://some.host:19531/'</programlisting>
        </listitem>
      </varlistentry>
    </variablelist>

    <para>Passive sources can be specified in the following
    ways:</para>

    <variablelist>
      <varlistentry>
        <term><option>--listen-raw=<replaceable>ADDRESS</replaceable></option></term>

        <listitem><para><replaceable>ADDRESS</replaceable> must be an
        address suitable for <option>ListenStream=</option> (cf.
        <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
        <command>systemd-journal-remote</command> will listen on this
        socket for connections. Each connection is expected to be a
        stream of journal events.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--listen-http=<replaceable>ADDRESS</replaceable></option></term>
        <term><option>--listen-https=<replaceable>ADDRESS</replaceable></option></term>

        <listitem><para><replaceable>ADDRESS</replaceable> must be
        either a negative integer, in which case it will be
        interpreted as the (negated) file descriptor number, or an
        address suitable for <option>ListenStream=</option> (c.f.
        <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
        In the first case, the server listens on port 19532 by default,
        and the matching file descriptor must be inherited through
        <varname>$LISTEN_FDS</varname>/<varname>$LISTEN_PID</varname>.
        In the second case, an HTTP or HTTPS server will be spawned on
        this port, respectively for <option>--listen-http=</option> and
        <option>--listen-https=</option>. Currently, only POST requests
        to <filename>/upload</filename> with <literal>Content-Type:
        application/vnd.fdo.journal</literal> are supported.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><varname>$LISTEN_FDS</varname></term>

        <listitem><para><command>systemd-journal-remote</command>
        supports the
        <varname>$LISTEN_FDS</varname>/<varname>$LISTEN_PID</varname>
        protocol. Open sockets inherited through socket activation
        behave like those opened with <option>--listen-raw=</option>
        described above, unless they are specified as an argument in
        <option>--listen-http=-<replaceable>n</replaceable></option>
        or
        <option>--listen-https=-<replaceable>n</replaceable></option>
        above. In the latter case, an HTTP or HTTPS server will be
        spawned using this descriptor and connections must be made
        over the HTTP protocol.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--key=</option></term>

        <listitem><para>Takes a path to a SSL secret key file in PEM format. Defaults to
        <filename>&CERTIFICATE_ROOT;/private/journal-remote.pem</filename>. This option can be used with
        <option>--listen-https=</option>. If the path refers to an <constant>AF_UNIX</constant> stream socket
        in the file system a connection is made to it and the key read from it.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--cert=</option></term>

        <listitem><para> Takes a path to a SSL certificate file in PEM format. Defaults to
        <filename>&CERTIFICATE_ROOT;/certs/journal-remote.pem</filename>. This option can be used with
        <option>--listen-https=</option>. If the path refers to an <constant>AF_UNIX</constant> stream socket
        in the file system a connection is made to it and the certificate read from it.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--trust=</option></term>

        <listitem><para> Takes a path to a SSL CA certificate file in PEM format, or <option>all</option>. If
        <option>all</option> is set, then certificate checking will be disabled. Defaults to
        <filename>&CERTIFICATE_ROOT;/ca/trusted.pem</filename>. This option can be used with
        <option>--listen-https=</option>. If the path refers to an <constant>AF_UNIX</constant> stream socket
        in the file system a connection is made to it and the certificate read from it.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--gnutls-log=</option></term>

        <listitem><para>
          Takes a comma separated list of gnutls logging categories.
          This option can be used with <option>--listen-http=</option> or
          <option>--listen-https=</option>.
        </para></listitem>
      </varlistentry>

    </variablelist>
  </refsect1>

  <refsect1>
    <title>Sinks</title>

    <para>The location of the output journal can be specified
    with <option>-o</option> or <option>--output=</option>.
    </para>

    <variablelist>
      <varlistentry>
        <term><option>-o <replaceable>FILE</replaceable></option></term>
        <term><option>--output=<replaceable>FILE</replaceable></option></term>

        <listitem><para>Will write to this journal file. The filename
        must end with <filename>.journal</filename>. The file will be
        created if it does not exist. If necessary (journal file full,
        or corrupted), the file will be renamed following normal
        journald rules and a new journal file will be created in its
        stead.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-o <replaceable>DIR</replaceable></option></term>
        <term><option>--output=<replaceable>DIR</replaceable></option></term>

        <listitem><para>Will create journal files underneath directory
        <replaceable>DIR</replaceable>. The directory must exist. If
        necessary (journal files over size, or corrupted), journal
        files will be rotated following normal journald rules. Names
        of files underneath <replaceable>DIR</replaceable> will be
        generated using the rules described below.</para></listitem>
      </varlistentry>
    </variablelist>

    <para>If <option>--output=</option> is not used, the output
    directory <filename>/var/log/journal/remote/</filename> will be
    used.  In case the output file is not specified, journal files
    will be created underneath the selected directory. Files will be
    called
    <filename>remote-<replaceable>hostname</replaceable>.journal</filename>,
    where the <replaceable>hostname</replaceable> part is the
    escaped hostname of the source endpoint of the connection, or the
    numerical address if the hostname cannot be determined.</para>

    <para>In the case that "active" sources are given by the positional
    arguments or <option>--getter=</option> option, the output file name
    must always be given explicitly.</para>
  </refsect1>

  <refsect1>
    <title>Options</title>

    <para>The following options are understood:</para>

    <variablelist>
      <varlistentry>
        <term><option>--split-mode</option></term>

        <listitem><para>One of <constant>none</constant> or
        <constant>host</constant>. For the first, only one output
        journal file is used. For the latter, a separate output file
        is used, based on the hostname of the other endpoint of a
        connection.</para>

        <para>In the case that "active" sources are given by the positional
        arguments or <option>--getter=</option> option, the output file name must
        always be given explicitly and only <constant>none</constant>
        is allowed.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--compress</option> [<replaceable>BOOL</replaceable>]</term>

        <listitem><para>If this is set to <literal>yes</literal> then compress
        the data in the journal using XZ. The default is <literal>yes</literal>.
        </para></listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--seal</option> [<replaceable>BOOL</replaceable>]</term>

        <listitem><para>If this is set to <literal>yes</literal> then
        periodically sign the data in the journal using Forward Secure Sealing.
        The default is <literal>no</literal>.</para></listitem>
      </varlistentry>

      <xi:include href="standard-options.xml" xpointer="help" />
      <xi:include href="standard-options.xml" xpointer="version" />
    </variablelist>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>Copy local journal events to a different journal directory:
    <programlisting>
journalctl -o export | systemd-journal-remote -o /tmp/dir/foo.journal -
    </programlisting>
    </para>

    <para>Retrieve all available events from a remote
    <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
    instance and store them in
    <filename>/var/log/journal/remote/remote-some.host.journal</filename>:
    <programlisting>
systemd-journal-remote --url http://some.host:19531/
    </programlisting>
    </para>

    <para>Retrieve current boot events and wait for new events from a remote
    <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
    instance, and store them in
    <filename>/var/log/journal/remote/remote-some.host.journal</filename>:
    <programlisting>
systemd-journal-remote --url http://some.host:19531/entries?boot&amp;follow
    </programlisting>
    </para>
</refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <citerefentry><refentrytitle>journal-remote.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>systemd-journal-gatewayd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>systemd-journal-upload.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
    </para>
  </refsect1>
</refentry>