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">
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
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.
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.
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/>.
24 <refentry id="systemd-cat"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
28 <title>systemd-cat</title>
29 <productname>systemd</productname>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
42 <refentrytitle>systemd-cat</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>systemd-cat</refname>
48 <refpurpose>Connect a pipeline or program's output with the journal</refpurpose>
53 <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg></command>
56 <command>systemd-cat <arg choice="opt" rep="repeat">OPTIONS</arg></command>
61 <title>Description</title>
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>
68 <para>If no parameter is passed, <command>systemd-cat</command>
69 will write everything it reads from standard input (stdin) to the
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
79 <title>Options</title>
81 <para>The following options are understood:</para>
84 <xi:include href="standard-options.xml" xpointer="help" />
85 <xi:include href="standard-options.xml" xpointer="version" />
88 <term><option>-t</option></term>
89 <term><option>--identifier=</option></term>
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>
97 <term><option>-p</option></term>
98 <term><option>--priority=</option></term>
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>
120 <term><option>--level-prefix=</option></term>
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><5></literal> is logged at priority 5
126 (<literal>notice</literal>), and similar for the other
127 priority levels. Takes a boolean argument.</para></listitem>
135 <title>Exit status</title>
137 <para>On success, 0 is returned, a non-zero failure code
142 <title>Examples</title>
145 <title>Invoke a program</title>
147 <para>This calls <filename noindex='true'>/bin/ls</filename>
148 with standard output and error connected to the journal:</para>
150 <programlisting># systemd-cat ls</programlisting>
154 <title>Usage in a shell pipeline</title>
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>
160 <programlisting># ls | systemd-cat</programlisting>
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>
170 <title>See Also</title>
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>