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