basic/linux: update kernel headers from v6.14-rc1
[systemd.io.git] / man / org.freedesktop.LogControl1.xml
blob4cc66ef03051d6e34fa5e950ef597c6a387b7da3
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="org.freedesktop.LogControl1"
7     xmlns:xi="http://www.w3.org/2001/XInclude">
8   <refentryinfo>
9     <title>org.freedesktop.LogControl1</title>
10     <productname>systemd</productname>
11   </refentryinfo>
13   <refmeta>
14     <refentrytitle>org.freedesktop.LogControl1</refentrytitle>
15     <manvolnum>5</manvolnum>
16   </refmeta>
18   <refnamediv>
19     <refname>org.freedesktop.LogControl1</refname>
20     <refpurpose>D-Bus interface to query and set logging configuration</refpurpose>
21   </refnamediv>
23   <refsect1>
24     <title>Introduction</title>
26     <para><interfacename>org.freedesktop.LogControl1</interfacename> is a generic interface that is intended
27     to be used by any daemon which allows the log level and target to be set over D-Bus. It is implemented by
28     various daemons that are part of the
29     <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> suite.</para>
31     <para>It is assumed that those settings are global for the whole program, so a fixed object path is
32     used. The interface should always be available under the path
33     <filename>/org/freedesktop/LogControl1</filename>.</para>
34   </refsect1>
36   <refsect1>
37     <title>Description</title>
39     <para>The following interface is exposed:</para>
41     <programlisting executable="systemd" node="/org/freedesktop/LogControl1" interface="org.freedesktop.LogControl1">
42 node /org/freedesktop/LogControl1 {
43   interface org.freedesktop.LogControl1 {
44     properties:
45       @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
46       @org.freedesktop.systemd1.Privileged("true")
47       readwrite s LogLevel = '...';
48       @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
49       @org.freedesktop.systemd1.Privileged("true")
50       readwrite s LogTarget = '...';
51       @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
52       readonly s SyslogIdentifier = '...';
53   };
54   interface org.freedesktop.DBus.Peer { ... };
55   interface org.freedesktop.DBus.Introspectable { ... };
56   interface org.freedesktop.DBus.Properties { ... };
58 </programlisting>
60     <!--Autogenerated cross-references for systemd.directives, do not edit-->
62     <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.LogControl1"/>
64     <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.LogControl1"/>
66     <variablelist class="dbus-property" generated="True" extra-ref="LogLevel"/>
68     <variablelist class="dbus-property" generated="True" extra-ref="LogTarget"/>
70     <variablelist class="dbus-property" generated="True" extra-ref="SyslogIdentifier"/>
72     <!--End of Autogenerated section-->
74     <refsect2>
75       <title>Properties</title>
77       <para><varname>LogLevel</varname> describes the
78       <citerefentry project="man-pages"><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>-style
79       log-level, and should be one of <literal>emerg</literal>, <literal>alert</literal>,
80       <literal>crit</literal>, <literal>err</literal>, <literal>warning</literal>, <literal>notice</literal>,
81       <literal>info</literal>, <literal>debug</literal>, in order of increasing verbosity.</para>
83       <para><varname>LogTarget</varname> describes the log target (mechanism). It should be one of
84       <literal>console</literal> (log to the console or standard output),
85       <literal>kmsg</literal> (log to the kernel ring buffer),
86       <literal>journal</literal> (log to the journal natively, see
87       <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>),
88       <literal>syslog</literal> (log using the
89       <citerefentry project="man-pages"><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> call).
90       </para>
92       <caution><title>Write Access</title><para>The <varname>LogLevel</varname> and
93       <varname>LogTarget</varname> properties are supposed to be writable. Care should be taken to ensure
94       that only appropriately privileged clients can modify them.</para></caution>
96       <para><varname>SyslogIdentifier</varname> is a read-only property that shows the "syslog identifier".
97       It is a short string that identifies the program that is the source of log messages that is passed to
98       the <citerefentry project="man-pages"><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> call.
99       </para>
100     </refsect2>
101   </refsect1>
103   <refsect1>
104     <title>Tools</title>
106     <para><command>journalctl</command> option <option>-p</option>/<option>--priority=</option> may be used
107     to filter log messages by log level, option <option>-t</option>/<option>--identifier=</option> may be
108     used to by the syslog identifier, and filters like <literal>_TRANSPORT=syslog</literal>,
109     <literal>_TRANSPORT=journal</literal>, and <literal>_TRANSPORT=kernel</literal> may be used to filter
110     messages by the mechanism through which they reached <command>systemd-journald</command>.</para>
112     <para><command>systemctl log-level</command> and <command>systemctl log-target</command> verbs may be
113     used to query and set the <varname>LogLevel</varname> and <varname>LogTarget</varname> properties of the
114     service manager. <command>systemctl service-log-level</command> and <command>systemctl
115     service-log-target</command> may similarly be used for individual services. (Services must have the
116     <varname>BusName=</varname> property set and must implement the interface described here. See
117     <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
118     for details about <varname>BusName=</varname>.)</para>
119   </refsect1>
121   <refsect1>
122     <title>Example</title>
124     <example>
125       <title>Create a simple listener on the bus that implements LogControl1</title>
127       <programlisting><xi:include href="logcontrol-example.c" parse="text"/></programlisting>
129       <para>This creates a simple server on the bus. It implements the LogControl1 interface by providing
130       the required properties and allowing to set the writable ones. It logs at the configured log level using
131       <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
133       <para>Note that when porting this example to other D-Bus libraries it might be necessary to add manual
134       client privilege checks, as they typically do not default to the restrictive defaults of sd-bus, where
135       unprivileged access to properties is controlled via the <constant>SD_BUS_VTABLE_UNPRIVILEGED</constant>
136       flag that is opt-in rather than opt-out.</para>
137     </example>
138   </refsect1>
140   <refsect1>
141     <title>See Also</title>
142     <para><simplelist type="inline">
143       <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
144       <member><citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
145       <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
146       <member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
147       <member><citerefentry project="man-pages"><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
148     </simplelist></para>
149   </refsect1>
150 </refentry>