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