libvirt
In certain cases logs generated from a custom logging or debugging configuration may be required to determine the cause of a problem.
libvirt
log controls #Edit source
libvirt
provides logging facilities for both the library and the
daemon. The behavior of the logging facility is controlled by adjusting
the log level, filter and output settings.
libvirt
log messages are classified into four priority levels:
DEBUG, INFO, WARNING and ERROR. The DEBUG level is verbose and
capable of generating gigabytes of information in a short time. The
volume of log messages progressively decreases with the INFO,
WARNING and ERROR log levels. ERROR is the default log level.
Log filters provide a way to log only messages matching a specific component and log level. Log filters allow collecting the verbose DEBUG log messages of specific components, but only ERROR level log messages from the rest of the system. By default, no log filters are defined.
Log outputs allow specifying where the filtered log messages are sent. Messages can be sent to a file, the standard error stream of the process, or journald. By default, filtered log messages are sent to journald.
See https://libvirt.org/logging.html for more
details on libvirt
's log controls.
A default libvirt
installation has the log level set to ERROR, no log
filters defined, and log outputs set to journald. Log messages from the
libvirt
daemon can be viewed with the journalctl
command:
#
journalctl --unit libvirtd
The default log facility settings are fine for normal operations and
provide useful messages for applications and users of libvirt
, but
internal issues often require DEBUG level messages. As an example,
consider a potential bug in the interaction between libvirt
and the
QEMU monitor. In this case, we only need to see the debug messages of
the communication between libvirt
and QEMU. The following example
creates a log filter to select debug messages from the QEMU driver and
send them to a file named /tmp/libvirtd.log
log_filters="1:qemu.qemu_monitor_json" log_outputs="1:file:/tmp/libvirtd.log"
Log controls for the libvirt
daemon can be found in
/etc/libvirt/libvirtd.conf
. The daemon must be
restarted after making any changes to the configuration file.
#
systemctl restart libvirtd.service