Debian Codegraph @

man/systemd-cat.xml

raw
1 <?xml version='1.0'?> <!--*-nxml-*-->
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-cat"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-cat</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-cat</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-cat</refname>
21 <refpurpose>Connect a pipeline or program's output with the journal</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>systemd-cat</command> <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg>
27 </cmdsynopsis>
28 <cmdsynopsis>
29 <command>systemd-cat</command> <arg choice="opt" rep="repeat">OPTIONS</arg>
30 </cmdsynopsis>
31 </refsynopsisdiv>
32
33 <refsect1>
34 <title>Description</title>
35
36 <para><command>systemd-cat</command> may be used to connect the
37 standard output and error output of a command to the journal, or
38 as a filter tool in a shell pipeline to pass the output the
39 previous pipeline element generates to the journal.</para>
40
41 <para>If no parameter is passed, <command>systemd-cat</command>
42 will write everything it reads from standard input (stdin) to the
43 journal.</para>
44
45 <para>If parameters are passed, they are executed as command line
46 with standard output (stdout) and standard error output (stderr)
47 connected to the journal, so that all it writes is stored in the
48 journal.</para>
49 </refsect1>
50
51 <refsect1>
52 <title>Options</title>
53
54 <para>The following options are understood:</para>
55
56 <variablelist>
57 <xi:include href="standard-options.xml" xpointer="help" />
58 <xi:include href="standard-options.xml" xpointer="version" />
59
60 <varlistentry>
61 <term><option>-t</option></term>
62 <term><option>--identifier=</option></term>
63
64 <listitem><para>Specify a short string that is used to
65 identify the logging tool. If not specified, no identification
66 string is set for the journal entry, and the executable name
67 (or <literal>cat</literal> if the input is read from a pipe)
68 will be used to describe the log source instead.
69 </para></listitem>
70 </varlistentry>
71
72 <varlistentry>
73 <term><option>-p</option></term>
74 <term><option>--priority=</option></term>
75
76 <listitem><para>Specify the default priority level for the
77 logged messages. Pass one of
78 <literal>emerg</literal>,
79 <literal>alert</literal>,
80 <literal>crit</literal>,
81 <literal>err</literal>,
82 <literal>warning</literal>,
83 <literal>notice</literal>,
84 <literal>info</literal>,
85 <literal>debug</literal>, or a
86 value between 0 and 7 (corresponding to the same named
87 levels). These priority values are the same as defined by
88 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
89 Defaults to <literal>info</literal>. Note that this simply
90 controls the default, individual lines may be logged with
91 different levels if they are prefixed accordingly. For details,
92 see <option>--level-prefix=</option> below.</para></listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><option>--stderr-priority=</option></term>
97
98 <listitem><para>Specifies the default priority level for
99 messages from the process's standard error output (stderr).
100 Usage of this option is the same as the
101 <option>--priority=</option> option, above, and both can be
102 used at once. When both are used, <option>--priority=</option>
103 will specify the default priority for standard output (stdout).
104 </para>
105
106 <para>If <option>--stderr-priority=</option> is not specified,
107 messages from stderr will still be logged, with the same
108 default priority level as stdout.</para>
109
110 <para>Also, note that when stdout and stderr use the same
111 default priority, the messages will be strictly ordered,
112 because one channel is used for both. When the default priority
113 differs, two channels are used, and so stdout messages will not
114 be strictly ordered with respect to stderr messages - though
115 they will tend to be approximately ordered.</para>
116
117 <xi:include href="version-info.xml" xpointer="v241"/></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><option>--level-prefix=</option></term>
122
123 <listitem><para>Controls whether lines read are parsed for syslog priority level prefixes. If enabled
124 (the default), a line prefixed with a priority prefix such as <literal>&lt;5&gt;</literal> is logged
125 at priority 5 (<literal>notice</literal>), and similarly for the other priority levels. Takes a
126 boolean argument.</para></listitem>
127 </varlistentry>
128
129 <varlistentry>
130 <term><option>--namespace=</option></term>
131
132 <listitem><para>Specifies the journal namespace to which the standard IO should be connected.
133 For details about journal namespaces, see
134 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
135 </para>
136
137 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
138 </varlistentry>
139
140 </variablelist>
141
142 </refsect1>
143
144 <refsect1>
145 <title>Exit status</title>
146
147 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
148 </refsect1>
149
150 <refsect1>
151 <title>Examples</title>
152
153 <example>
154 <title>Invoke a program</title>
155
156 <para>This calls <filename index="false">/bin/ls</filename>
157 with standard output and error connected to the journal:</para>
158
159 <programlisting># systemd-cat ls</programlisting>
160 </example>
161
162 <example>
163 <title>Usage in a shell pipeline</title>
164
165 <para>This builds a shell pipeline also invoking
166 <filename>/bin/ls</filename> and writes the output it generates
167 to the journal:</para>
168
169 <programlisting># ls | systemd-cat</programlisting>
170 </example>
171
172 <para>Even though the two examples have very similar effects, the first is preferable, since only one
173 process is running at a time and both stdout and stderr are captured, while in the second example, only
174 stdout is captured.</para>
175 </refsect1>
176
177 <refsect1>
178 <title>See Also</title>
179 <para><simplelist type="inline">
180 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
181 <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
182 <member><citerefentry project='man-pages'><refentrytitle>logger</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
183 </simplelist></para>
184 </refsect1>
185
186 </refentry>