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