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