| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-journal-gatewayd.service" conditional='ENABLE_REMOTE HAVE_MICROHTTPD' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-journal-gatewayd.service</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-journal-gatewayd.service</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-journal-gatewayd.service</refname> |
| 21 |
<refname>systemd-journal-gatewayd.socket</refname> |
| 22 |
<refname>systemd-journal-gatewayd</refname> |
| 23 |
<refpurpose>HTTP server for journal events</refpurpose> |
| 24 |
</refnamediv> |
| 25 |
|
| 26 |
<refsynopsisdiv> |
| 27 |
<para><filename>systemd-journal-gatewayd.service</filename></para> |
| 28 |
<para><filename>systemd-journal-gatewayd.socket</filename></para> |
| 29 |
<cmdsynopsis> |
| 30 |
<command>/usr/lib/systemd/systemd-journal-gatewayd</command> |
| 31 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 32 |
</cmdsynopsis> |
| 33 |
</refsynopsisdiv> |
| 34 |
|
| 35 |
<refsect1> |
| 36 |
<title>Description</title> |
| 37 |
|
| 38 |
<para><command>systemd-journal-gatewayd</command> serves journal |
| 39 |
events over the network. Clients must connect using |
| 40 |
HTTP. The server listens on port 19531 by default. |
| 41 |
If <option>--cert=</option> is specified, the server expects |
| 42 |
HTTPS connections.</para> |
| 43 |
|
| 44 |
<para>The program is started by |
| 45 |
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 46 |
and expects to receive a single socket. Use |
| 47 |
<command>systemctl start systemd-journal-gatewayd.socket</command> to start |
| 48 |
the service, and <command>systemctl enable systemd-journal-gatewayd.socket</command> |
| 49 |
to have it started on boot.</para> |
| 50 |
</refsect1> |
| 51 |
|
| 52 |
<refsect1> |
| 53 |
<title>Options</title> |
| 54 |
|
| 55 |
<para>The following options are understood:</para> |
| 56 |
|
| 57 |
<variablelist> |
| 58 |
<varlistentry> |
| 59 |
<term><option>--cert=</option></term> |
| 60 |
|
| 61 |
<listitem><para>Specify the path to a file or <constant>AF_UNIX</constant> stream socket to read the |
| 62 |
server certificate from. The certificate must be in PEM format. This option switches |
| 63 |
<command>systemd-journal-gatewayd</command> into HTTPS mode and must be used together with |
| 64 |
<option>--key=</option>.</para> |
| 65 |
|
| 66 |
<xi:include href="version-info.xml" xpointer="v198"/></listitem> |
| 67 |
</varlistentry> |
| 68 |
|
| 69 |
<varlistentry> |
| 70 |
<term><option>--key=</option></term> |
| 71 |
|
| 72 |
<listitem><para>Specify the path to a file or <constant>AF_UNIX</constant> stream socket to read the |
| 73 |
secret server key corresponding to the certificate specified with <option>--cert=</option> from. The |
| 74 |
key must be in PEM format.</para> |
| 75 |
|
| 76 |
<xi:include href="version-info.xml" xpointer="v198"/></listitem> |
| 77 |
</varlistentry> |
| 78 |
|
| 79 |
<varlistentry> |
| 80 |
<term><option>--trust=</option></term> |
| 81 |
|
| 82 |
<listitem><para>Specify the path to a file or <constant>AF_UNIX</constant> stream socket to read a CA |
| 83 |
certificate from. The certificate must be in PEM format.</para> |
| 84 |
|
| 85 |
<xi:include href="version-info.xml" xpointer="v236"/></listitem> |
| 86 |
</varlistentry> |
| 87 |
|
| 88 |
<varlistentry> |
| 89 |
<term><option>--system</option></term> |
| 90 |
<term><option>--user</option></term> |
| 91 |
|
| 92 |
<listitem><para>Limit served entries to entries from system |
| 93 |
services and the kernel, or to entries from services of |
| 94 |
current user. This has the same meaning as |
| 95 |
<option>--system</option> and <option>--user</option> options |
| 96 |
for |
| 97 |
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. If |
| 98 |
neither is specified, all accessible entries are served. |
| 99 |
</para> |
| 100 |
|
| 101 |
<xi:include href="version-info.xml" xpointer="v249"/></listitem> |
| 102 |
</varlistentry> |
| 103 |
|
| 104 |
<varlistentry> |
| 105 |
<term><option>-m</option></term> |
| 106 |
<term><option>--merge</option></term> |
| 107 |
|
| 108 |
<listitem><para>Serve entries interleaved from all available |
| 109 |
journals, including other machines. This has the same meaning |
| 110 |
as <option>--merge</option> option for |
| 111 |
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para> |
| 112 |
|
| 113 |
<xi:include href="version-info.xml" xpointer="v249"/></listitem> |
| 114 |
</varlistentry> |
| 115 |
|
| 116 |
<varlistentry> |
| 117 |
<term><option>-D <replaceable>DIR</replaceable></option></term> |
| 118 |
<term><option>--directory=<replaceable>DIR</replaceable></option></term> |
| 119 |
|
| 120 |
<listitem><para>Takes a directory path as argument. If |
| 121 |
specified, <command>systemd-journal-gatewayd</command> will serve the |
| 122 |
specified journal directory <replaceable>DIR</replaceable> instead of |
| 123 |
the default runtime and system journal paths.</para> |
| 124 |
|
| 125 |
<xi:include href="version-info.xml" xpointer="v232"/></listitem> |
| 126 |
</varlistentry> |
| 127 |
|
| 128 |
<varlistentry> |
| 129 |
<term><option>--file=<replaceable>GLOB</replaceable></option></term> |
| 130 |
|
| 131 |
<listitem><para>Takes a file glob as an argument. Serve |
| 132 |
entries from the specified journal files matching |
| 133 |
<replaceable>GLOB</replaceable> instead of the default runtime |
| 134 |
and system journal paths. May be specified multiple times, in |
| 135 |
which case files will be suitably interleaved. This has the same meaning as |
| 136 |
<option>--file=</option> option for |
| 137 |
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
| 138 |
</para> |
| 139 |
|
| 140 |
<xi:include href="version-info.xml" xpointer="v249"/></listitem> |
| 141 |
</varlistentry> |
| 142 |
|
| 143 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 144 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 145 |
</variablelist> |
| 146 |
</refsect1> |
| 147 |
|
| 148 |
<refsect1> |
| 149 |
<title>Supported URLs</title> |
| 150 |
|
| 151 |
<para>The following URLs are recognized:</para> |
| 152 |
|
| 153 |
<variablelist> |
| 154 |
<varlistentry> |
| 155 |
<term><uri>/boots</uri></term> |
| 156 |
|
| 157 |
<listitem><para>Returns json-seq (RFC 7464) response containing JSON objects, each one containing |
| 158 |
boot number, its ID and the timestamps of the first and last message. Boots are returned starting |
| 159 |
with the latest boot first and use the same schema as |
| 160 |
<command>journalctl --list-boots --output json</command>.</para> |
| 161 |
|
| 162 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 163 |
</varlistentry> |
| 164 |
|
| 165 |
<varlistentry> |
| 166 |
<term><uri>/browse</uri></term> |
| 167 |
|
| 168 |
<listitem><para>Interactive browsing.</para> |
| 169 |
|
| 170 |
<xi:include href="version-info.xml" xpointer="v197"/></listitem> |
| 171 |
</varlistentry> |
| 172 |
|
| 173 |
<varlistentry> |
| 174 |
<term><uri>/entries[?option1&option2=value…]</uri></term> |
| 175 |
|
| 176 |
<listitem><para>Retrieval of events in various formats.</para> |
| 177 |
|
| 178 |
<para>The <option>Accept:</option> part of the HTTP header |
| 179 |
determines the format. Supported values are described below. |
| 180 |
</para> |
| 181 |
|
| 182 |
<para>The <option>Range:</option> part of the HTTP header |
| 183 |
determines the range of events returned. Supported values are |
| 184 |
described below. |
| 185 |
</para> |
| 186 |
|
| 187 |
<para>GET parameters can be used to modify what events are |
| 188 |
returned. Supported parameters are described below.</para> |
| 189 |
|
| 190 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 191 |
</listitem> |
| 192 |
</varlistentry> |
| 193 |
|
| 194 |
<varlistentry> |
| 195 |
<term><uri>/machine</uri></term> |
| 196 |
|
| 197 |
<listitem><para>Return a JSON structure describing the machine.</para> |
| 198 |
|
| 199 |
<para>Example: |
| 200 |
<programlisting>{ "machine_id" : "8cf7ed9d451ea194b77a9f118f3dc446", |
| 201 |
"boot_id" : "3d3c9efaf556496a9b04259ee35df7f7", |
| 202 |
"hostname" : "fedora", |
| 203 |
"os_pretty_name" : "Fedora 19 (Rawhide)", |
| 204 |
"virtualization" : "kvm", |
| 205 |
…}</programlisting> |
| 206 |
</para> |
| 207 |
|
| 208 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 209 |
</listitem> |
| 210 |
</varlistentry> |
| 211 |
|
| 212 |
<varlistentry> |
| 213 |
<term><uri>/fields/<replaceable>FIELD_NAME</replaceable></uri></term> |
| 214 |
|
| 215 |
<listitem><para>Return a list of values of this field present in the logs.</para> |
| 216 |
|
| 217 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 218 |
</listitem> |
| 219 |
</varlistentry> |
| 220 |
</variablelist> |
| 221 |
</refsect1> |
| 222 |
|
| 223 |
<refsect1> |
| 224 |
<title>Accept header</title> |
| 225 |
|
| 226 |
<para> |
| 227 |
<option>Accept: <replaceable>format</replaceable></option> |
| 228 |
</para> |
| 229 |
|
| 230 |
<para>Recognized formats:</para> |
| 231 |
|
| 232 |
<variablelist> |
| 233 |
<varlistentry> |
| 234 |
<term><constant>text/plain</constant></term> |
| 235 |
|
| 236 |
<listitem><para>The default. Plaintext syslog-like output, |
| 237 |
one line per journal entry |
| 238 |
(like <command>journalctl --output short</command>).</para> |
| 239 |
|
| 240 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 241 |
</listitem> |
| 242 |
</varlistentry> |
| 243 |
|
| 244 |
<varlistentry> |
| 245 |
<term><constant>application/json</constant></term> |
| 246 |
|
| 247 |
<listitem><para>Entries are formatted as JSON data structures, |
| 248 |
one per line |
| 249 |
(like <command>journalctl --output json</command>). |
| 250 |
See <ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format">Journal JSON Format</ulink> |
| 251 |
for more information.</para> |
| 252 |
|
| 253 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 254 |
</listitem> |
| 255 |
</varlistentry> |
| 256 |
|
| 257 |
<varlistentry> |
| 258 |
<term><constant>text/event-stream</constant></term> |
| 259 |
|
| 260 |
<listitem><para>Entries are formatted as JSON data structures, |
| 261 |
wrapped in a format suitable for <ulink |
| 262 |
url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events"> |
| 263 |
Server-Sent Events</ulink> |
| 264 |
(like <command>journalctl --output json-sse</command>). |
| 265 |
</para> |
| 266 |
|
| 267 |
<xi:include href="version-info.xml" xpointer="v229"/> |
| 268 |
</listitem> |
| 269 |
</varlistentry> |
| 270 |
|
| 271 |
<varlistentry> |
| 272 |
<term><constant>application/vnd.fdo.journal</constant></term> |
| 273 |
|
| 274 |
<listitem><para>Entries are serialized into a binary (but mostly text-based) stream suitable for |
| 275 |
backups and network transfer (like <command>journalctl --output export</command>). See <ulink |
| 276 |
url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink> |
| 277 |
for more information.</para> |
| 278 |
|
| 279 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 280 |
</listitem> |
| 281 |
</varlistentry> |
| 282 |
</variablelist> |
| 283 |
</refsect1> |
| 284 |
|
| 285 |
<refsect1> |
| 286 |
<title>Range header</title> |
| 287 |
|
| 288 |
<para> |
| 289 |
<option>Range: entries=[<replaceable>cursor</replaceable>][[:<replaceable>num_skip</replaceable>]:[<replaceable>num_entries</replaceable>]]</option> |
| 290 |
</para> |
| 291 |
<para> |
| 292 |
<option>Range: realtime=[<replaceable>since</replaceable>]:[<replaceable>until</replaceable>][[:<replaceable>num_skip</replaceable>]:<replaceable>num_entries</replaceable>]</option> |
| 293 |
</para> |
| 294 |
|
| 295 |
<para>where |
| 296 |
<replaceable>cursor</replaceable> is a cursor string, defaults to the first entry, |
| 297 |
<replaceable>since</replaceable> and <replaceable>until</replaceable> are timestamps (seconds since 1970-01-01 00:00:00 UTC), |
| 298 |
<replaceable>num_skip</replaceable> is an integer, |
| 299 |
<replaceable>num_entries</replaceable> is an unsigned integer. |
| 300 |
</para> |
| 301 |
|
| 302 |
<para>Range defaults to all available events.</para> |
| 303 |
|
| 304 |
<para>If <replaceable>num_skip</replaceable> is negative and no <replaceable>cursor</replaceable> is |
| 305 |
given, the last entry will be the reference point.</para> |
| 306 |
</refsect1> |
| 307 |
|
| 308 |
<refsect1> |
| 309 |
<title>URL GET parameters</title> |
| 310 |
|
| 311 |
<para>Following parameters can be used as part of the URL:</para> |
| 312 |
|
| 313 |
<variablelist> |
| 314 |
<varlistentry> |
| 315 |
<term><uri>follow</uri></term> |
| 316 |
|
| 317 |
<listitem><para>wait for new events (like <command>journalctl --follow</command>, the number of |
| 318 |
events returned is not limited, unless <replaceable>num_entries</replaceable> is specified in the |
| 319 |
<replaceable>Range</replaceable> header).</para> |
| 320 |
|
| 321 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 322 |
</listitem> |
| 323 |
</varlistentry> |
| 324 |
|
| 325 |
<varlistentry> |
| 326 |
<term><uri>discrete</uri></term> |
| 327 |
|
| 328 |
<listitem><para>Test that the specified cursor refers to an |
| 329 |
entry in the journal. Returns just this entry.</para> |
| 330 |
|
| 331 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 332 |
</listitem> |
| 333 |
</varlistentry> |
| 334 |
|
| 335 |
<varlistentry> |
| 336 |
<term><uri>boot</uri></term> |
| 337 |
|
| 338 |
<listitem><para>Limit events to the current boot of the system |
| 339 |
(like <command>journalctl -b</command>).</para> |
| 340 |
|
| 341 |
<xi:include href="version-info.xml" xpointer="v197"/></listitem> |
| 342 |
</varlistentry> |
| 343 |
|
| 344 |
<varlistentry> |
| 345 |
<term><uri><replaceable>KEY</replaceable>=<replaceable>match</replaceable></uri></term> |
| 346 |
|
| 347 |
<listitem><para>Match journal fields. See |
| 348 |
<citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> |
| 349 |
|
| 350 |
<xi:include href="version-info.xml" xpointer="v197"/> |
| 351 |
</listitem> |
| 352 |
</varlistentry> |
| 353 |
</variablelist> |
| 354 |
</refsect1> |
| 355 |
|
| 356 |
<refsect1> |
| 357 |
<title>Examples</title> |
| 358 |
<para>Retrieve events from this boot from local journal in |
| 359 |
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>: |
| 360 |
<programlisting>curl --silent -H'Accept: application/vnd.fdo.journal' \ |
| 361 |
'http://localhost:19531/entries?boot'</programlisting> |
| 362 |
</para> |
| 363 |
|
| 364 |
<para>Listen for core dumps: |
| 365 |
<programlisting>curl 'http://localhost:19531/entries?follow&MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1'</programlisting></para> |
| 366 |
</refsect1> |
| 367 |
|
| 368 |
<refsect1> |
| 369 |
<title>See Also</title> |
| 370 |
<para><simplelist type="inline"> |
| 371 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 372 |
<member><citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 373 |
<member><citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 374 |
<member><citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 375 |
<member><citerefentry><refentrytitle>systemd-journal-remote.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 376 |
<member><citerefentry><refentrytitle>systemd-journal-upload.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 377 |
</simplelist></para> |
| 378 |
</refsect1> |
| 379 |
|
| 380 |
</refentry> |