]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-cat.xml
Merge pull request #9274 from poettering/comment-header-cleanup
[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
16 <authorgroup>
17 <author>
18 <contrib>Developer</contrib>
19 <firstname>Lennart</firstname>
20 <surname>Poettering</surname>
21 <email>lennart@poettering.net</email>
22 </author>
23 </authorgroup>
24 </refentryinfo>
25
26 <refmeta>
27 <refentrytitle>systemd-cat</refentrytitle>
28 <manvolnum>1</manvolnum>
29 </refmeta>
30
31 <refnamediv>
32 <refname>systemd-cat</refname>
33 <refpurpose>Connect a pipeline or program's output with the journal</refpurpose>
34 </refnamediv>
35
36 <refsynopsisdiv>
37 <cmdsynopsis>
38 <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg></command>
39 </cmdsynopsis>
40 <cmdsynopsis>
41 <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg></command>
42 </cmdsynopsis>
43 </refsynopsisdiv>
44
45 <refsect1>
46 <title>Description</title>
47
48 <para><command>systemd-cat</command> may be used to connect the
49 standard input and output of a process to the journal, or as a
50 filter tool in a shell pipeline to pass the output the previous
51 pipeline element generates to the journal.</para>
52
53 <para>If no parameter is passed, <command>systemd-cat</command>
54 will write everything it reads from standard input (stdin) to the
55 journal.</para>
56
57 <para>If parameters are passed, they are executed as command line
58 with standard output (stdout) and standard error output (stderr)
59 connected to the journal, so that all it writes is stored in the
60 journal.</para>
61 </refsect1>
62
63 <refsect1>
64 <title>Options</title>
65
66 <para>The following options are understood:</para>
67
68 <variablelist>
69 <xi:include href="standard-options.xml" xpointer="help" />
70 <xi:include href="standard-options.xml" xpointer="version" />
71
72 <varlistentry>
73 <term><option>-t</option></term>
74 <term><option>--identifier=</option></term>
75
76 <listitem><para>Specify a short string that is used to
77 identify the logging tool. If not specified, no identification
78 string is written to the journal.</para></listitem>
79 </varlistentry>
80
81 <varlistentry>
82 <term><option>-p</option></term>
83 <term><option>--priority=</option></term>
84
85 <listitem><para>Specify the default priority level for the
86 logged messages. Pass one of
87 <literal>emerg</literal>,
88 <literal>alert</literal>,
89 <literal>crit</literal>,
90 <literal>err</literal>,
91 <literal>warning</literal>,
92 <literal>notice</literal>,
93 <literal>info</literal>,
94 <literal>debug</literal>, or a
95 value between 0 and 7 (corresponding to the same named
96 levels). These priority values are the same as defined by
97 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
98 Defaults to <literal>info</literal>. Note that this simply
99 controls the default, individual lines may be logged with
100 different levels if they are prefixed accordingly. For details,
101 see <option>--level-prefix=</option> below.</para></listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><option>--level-prefix=</option></term>
106
107 <listitem><para>Controls whether lines read are parsed for
108 syslog priority level prefixes. If enabled (the default), a
109 line prefixed with a priority prefix such as
110 <literal>&lt;5&gt;</literal> is logged at priority 5
111 (<literal>notice</literal>), and similar for the other
112 priority levels. Takes a boolean argument.</para></listitem>
113 </varlistentry>
114
115 </variablelist>
116
117 </refsect1>
118
119 <refsect1>
120 <title>Exit status</title>
121
122 <para>On success, 0 is returned, a non-zero failure code
123 otherwise.</para>
124 </refsect1>
125
126 <refsect1>
127 <title>Examples</title>
128
129 <example>
130 <title>Invoke a program</title>
131
132 <para>This calls <filename noindex='true'>/bin/ls</filename>
133 with standard output and error connected to the journal:</para>
134
135 <programlisting># systemd-cat ls</programlisting>
136 </example>
137
138 <example>
139 <title>Usage in a shell pipeline</title>
140
141 <para>This builds a shell pipeline also invoking
142 <filename>/bin/ls</filename> and writes the output it generates
143 to the journal:</para>
144
145 <programlisting># ls | systemd-cat</programlisting>
146 </example>
147
148 <para>Even though the two examples have very similar effects the
149 first is preferable since only one process is running at a time,
150 and both stdout and stderr are captured while in the second
151 example, only stdout is captured.</para>
152 </refsect1>
153
154 <refsect1>
155 <title>See Also</title>
156 <para>
157 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
158 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
159 <citerefentry project='man-pages'><refentrytitle>logger</refentrytitle><manvolnum>1</manvolnum></citerefentry>
160 </para>
161 </refsect1>
162
163 </refentry>