]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-cat.xml
Merge pull request #11345 from kirbyfan64/tmpfiles-c-empty
[thirdparty/systemd.git] / man / systemd-cat.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="systemd-cat"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>systemd-cat</title>
14 <productname>systemd</productname>
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>systemd-cat</refentrytitle>
19 <manvolnum>1</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>systemd-cat</refname>
24 <refpurpose>Connect a pipeline or program's output with the journal</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <cmdsynopsis>
29 <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg></command>
30 </cmdsynopsis>
31 <cmdsynopsis>
32 <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg></command>
33 </cmdsynopsis>
34 </refsynopsisdiv>
35
36 <refsect1>
37 <title>Description</title>
38
39 <para><command>systemd-cat</command> may be used to connect the
40 standard input and output of a process to the journal, or as a
41 filter tool in a shell pipeline to pass the output the previous
42 pipeline element generates to the journal.</para>
43
44 <para>If no parameter is passed, <command>systemd-cat</command>
45 will write everything it reads from standard input (stdin) to the
46 journal.</para>
47
48 <para>If parameters are passed, they are executed as command line
49 with standard output (stdout) and standard error output (stderr)
50 connected to the journal, so that all it writes is stored in the
51 journal.</para>
52 </refsect1>
53
54 <refsect1>
55 <title>Options</title>
56
57 <para>The following options are understood:</para>
58
59 <variablelist>
60 <xi:include href="standard-options.xml" xpointer="help" />
61 <xi:include href="standard-options.xml" xpointer="version" />
62
63 <varlistentry>
64 <term><option>-t</option></term>
65 <term><option>--identifier=</option></term>
66
67 <listitem><para>Specify a short string that is used to
68 identify the logging tool. If not specified, no identification
69 string is written to the journal.</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></listitem>
116 </varlistentry>
117
118 <varlistentry>
119 <term><option>--level-prefix=</option></term>
120
121 <listitem><para>Controls whether lines read are parsed for
122 syslog priority level prefixes. If enabled (the default), a
123 line prefixed with a priority prefix such as
124 <literal>&lt;5&gt;</literal> is logged at priority 5
125 (<literal>notice</literal>), and similar for the other
126 priority levels. Takes a boolean argument.</para></listitem>
127 </varlistentry>
128
129 </variablelist>
130
131 </refsect1>
132
133 <refsect1>
134 <title>Exit status</title>
135
136 <para>On success, 0 is returned, a non-zero failure code
137 otherwise.</para>
138 </refsect1>
139
140 <refsect1>
141 <title>Examples</title>
142
143 <example>
144 <title>Invoke a program</title>
145
146 <para>This calls <filename noindex='true'>/bin/ls</filename>
147 with standard output and error connected to the journal:</para>
148
149 <programlisting># systemd-cat ls</programlisting>
150 </example>
151
152 <example>
153 <title>Usage in a shell pipeline</title>
154
155 <para>This builds a shell pipeline also invoking
156 <filename>/bin/ls</filename> and writes the output it generates
157 to the journal:</para>
158
159 <programlisting># ls | systemd-cat</programlisting>
160 </example>
161
162 <para>Even though the two examples have very similar effects the
163 first is preferable since only one process is running at a time,
164 and both stdout and stderr are captured while in the second
165 example, only stdout is captured.</para>
166 </refsect1>
167
168 <refsect1>
169 <title>See Also</title>
170 <para>
171 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
172 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
173 <citerefentry project='man-pages'><refentrytitle>logger</refentrytitle><manvolnum>1</manvolnum></citerefentry>
174 </para>
175 </refsect1>
176
177 </refentry>