org.freedesktop.LogControl1systemdorg.freedesktop.LogControl15org.freedesktop.LogControl1D-Bus interface to query and set logging configurationIntroductionorg.freedesktop.LogControl1 is a generic interface that is intended
to be used by any daemon which allows the log level and target to be set over D-Bus. It is implemented by
various daemons that are part of the
systemd1 suite.It is assumed that those settings are global for the whole program, so a fixed object path is
used. The interface should always be available under the path
/org/freedesktop/LogControl1.DescriptionThe following interface is exposed:
node /org/freedesktop/LogControl1 {
interface org.freedesktop.LogControl1 {
properties:
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
@org.freedesktop.systemd1.Privileged("true")
readwrite s LogLevel = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
@org.freedesktop.systemd1.Privileged("true")
readwrite s LogTarget = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
readonly s SyslogIdentifier = '...';
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
};
PropertiesLogLevel describes the
syslog3-style
log-level, and should be one of emerg, alert,
crit, err, warning, notice,
info, debug, in order of increasing verbosity.LogTarget describes the log target (mechanism). It should be one of
console (log to the console or standard output),
kmsg (log to the kernel ring buffer),
journal (log to the journal natively, see
systemd-journald.service8),
syslog (log using the
syslog3 call).
Write AccessThe LogLevel and
LogTarget properties are supposed to be writable. Care should be taken to ensure
that only appropriately privileged clients can modify them.SyslogIdentifier is a read-only property that shows the "syslog identifier".
It is a short string that identifies the program that is the source of log messages that is passed to
the syslog3 call.
Toolsjournalctl option / may be used
to filter log messages by log level, option / may be
used to by the syslog identifier, and filters like _TRANSPORT=syslog,
_TRANSPORT=journal, and _TRANSPORT=kernel may be used to filter
messages by the mechanism through which they reached systemd-journald.systemctl log-level and systemctl log-target verbs may be
used to query and set the LogLevel and LogTarget properties of the
service manager. systemctl service-log-level and systemctl
service-log-target may similarly be used for individual services. (Services must have the
BusName= property set and must implement the interface described here. See
systemd.service5
for details about BusName=.)ExampleCreate a simple listener on the bus that implements LogControl1This creates a simple server on the bus. It implements the LogControl1 interface by providing
the required properties and allowing to set the writable ones. It logs at the configured log level using
sd_journal_print3.Note that when porting this example to other D-Bus libraries it might be necessary to add manual
client privilege checks, as they typically do not default to the restrictive defaults of sd-bus, where
unprivileged access to properties is controlled via the SD_BUS_VTABLE_UNPRIVILEGED
flag that is opt-in rather than opt-out.See Alsosystemd1journalctl1systemctl1systemd.service5syslog3