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