]>
Commit | Line | Data |
---|---|---|
9aac0b2c | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
9aac0b2c | 5 | |
dfdebb1b | 6 | <refentry id="systemd-cat" |
798d3a52 ZJS |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | ||
9 | <refentryinfo> | |
10 | <title>systemd-cat</title> | |
11 | <productname>systemd</productname> | |
798d3a52 ZJS |
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 <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg></command> | |
27 | </cmdsynopsis> | |
28 | <cmdsynopsis> | |
29 | <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg></command> | |
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 input and output of a process to the journal, or as a | |
38 | filter tool in a shell pipeline to pass the output the previous | |
39 | 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 written to the journal.</para></listitem> | |
67 | </varlistentry> | |
68 | ||
69 | <varlistentry> | |
70 | <term><option>-p</option></term> | |
71 | <term><option>--priority=</option></term> | |
72 | ||
73 | <listitem><para>Specify the default priority level for the | |
74 | logged messages. Pass one of | |
75 | <literal>emerg</literal>, | |
76 | <literal>alert</literal>, | |
77 | <literal>crit</literal>, | |
78 | <literal>err</literal>, | |
79 | <literal>warning</literal>, | |
80 | <literal>notice</literal>, | |
81 | <literal>info</literal>, | |
82 | <literal>debug</literal>, or a | |
83 | value between 0 and 7 (corresponding to the same named | |
84 | levels). These priority values are the same as defined by | |
85 | <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
86 | Defaults to <literal>info</literal>. Note that this simply | |
87 | controls the default, individual lines may be logged with | |
b938cb90 | 88 | different levels if they are prefixed accordingly. For details, |
798d3a52 ZJS |
89 | see <option>--level-prefix=</option> below.</para></listitem> |
90 | </varlistentry> | |
91 | ||
a08c3e8f MS |
92 | <varlistentry> |
93 | <term><option>--stderr-priority=</option></term> | |
94 | ||
95 | <listitem><para>Specifies the default priority level for | |
96 | messages from the process's standard error output (stderr). | |
97 | Usage of this option is the same as the | |
98 | <option>--priority=</option> option, above, and both can be | |
99 | used at once. When both are used, <option>--priority=</option> | |
100 | will specify the default priority for standard output (stdout). | |
101 | </para> | |
102 | ||
103 | <para>If <option>--stderr-priority=</option> is not specified, | |
104 | messages from stderr will still be logged, with the same | |
105 | default priority level as stdout.</para> | |
106 | ||
107 | <para>Also, note that when stdout and stderr use the same | |
108 | default priority, the messages will be strictly ordered, | |
109 | because one channel is used for both. When the default priority | |
110 | differs, two channels are used, and so stdout messages will not | |
111 | be strictly ordered with respect to stderr messages - though | |
ec07c3c8 AK |
112 | they will tend to be approximately ordered.</para> |
113 | ||
114 | <xi:include href="version-info.xml" xpointer="v241"/></listitem> | |
a08c3e8f MS |
115 | </varlistentry> |
116 | ||
798d3a52 ZJS |
117 | <varlistentry> |
118 | <term><option>--level-prefix=</option></term> | |
119 | ||
15102ced ZJS |
120 | <listitem><para>Controls whether lines read are parsed for syslog priority level prefixes. If enabled |
121 | (the default), a line prefixed with a priority prefix such as <literal><5></literal> is logged | |
122 | at priority 5 (<literal>notice</literal>), and similarly for the other priority levels. Takes a | |
123 | boolean argument.</para></listitem> | |
798d3a52 ZJS |
124 | </varlistentry> |
125 | ||
126 | </variablelist> | |
127 | ||
128 | </refsect1> | |
129 | ||
130 | <refsect1> | |
131 | <title>Exit status</title> | |
132 | ||
133 | <para>On success, 0 is returned, a non-zero failure code | |
134 | otherwise.</para> | |
135 | </refsect1> | |
136 | ||
137 | <refsect1> | |
138 | <title>Examples</title> | |
139 | ||
140 | <example> | |
141 | <title>Invoke a program</title> | |
142 | ||
b0343f8c | 143 | <para>This calls <filename index="false">/bin/ls</filename> |
798d3a52 ZJS |
144 | with standard output and error connected to the journal:</para> |
145 | ||
146 | <programlisting># systemd-cat ls</programlisting> | |
147 | </example> | |
148 | ||
149 | <example> | |
150 | <title>Usage in a shell pipeline</title> | |
151 | ||
152 | <para>This builds a shell pipeline also invoking | |
153 | <filename>/bin/ls</filename> and writes the output it generates | |
154 | to the journal:</para> | |
155 | ||
156 | <programlisting># ls | systemd-cat</programlisting> | |
157 | </example> | |
158 | ||
15102ced ZJS |
159 | <para>Even though the two examples have very similar effects, the first is preferable, since only one |
160 | process is running at a time and both stdout and stderr are captured, while in the second example, only | |
161 | stdout is captured.</para> | |
798d3a52 ZJS |
162 | </refsect1> |
163 | ||
164 | <refsect1> | |
165 | <title>See Also</title> | |
13a69c12 DT |
166 | <para><simplelist type="inline"> |
167 | <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
168 | <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
169 | <member><citerefentry project='man-pages'><refentrytitle>logger</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
170 | </simplelist></para> | |
798d3a52 | 171 | </refsect1> |
9aac0b2c LP |
172 | |
173 | </refentry> |