DebugLogs

From Libvirt Wiki
Jump to: navigation, search

Turning on debug logs

If you report a bug against libvirt, in most cases you will be asked to attach debug logs. These are bare text files which tracks transition between different states of libvirtd, what it has tried to achieve, etc. Because of client -- server schema used in libvirt, the logs can be either client or server too. Usually, it's server side that matters as nearly all interesting work takes place there. Moreover, libvirt catches stderr of all running domains. These can be useful as well.


How to turn on debug logs for libvirt

The daemon configuration files location is dependent on connection URI. For qemu:///system:


  • open /etc/libvirt/libvirtd.conf in your favourite editor
  • find & replace, or set these variables:
log_level = 1
log_filters="3:remote 4:event 3:json 3:rpc"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
  • save and exit
  • restart libvirtd service
systemctl restart libvirtd.service

In the config variables above, we have set logging level to 1 (debug level), set some filters, e.g. from rpc only warnings (=level 3) and above will be reported. The logs are saved into /var/log/libvirt/libvirtd.log For full description continue reading here. In case you want to get the client logs, you need to set this environment variable:

export LIBVIRT_LOG_OUTPUTS="1:file:/tmp/libvirt_client.log"


However, when you are using the session mode qemu:///session or you run the libvirtd as unprivileged user you will find configuration file under $XDG_CONFIG_HOME/libvirt/libvirt.conf.

What to attach?

Now you should go and reproduce the bug. Once you're finished, attach:

  • /var/log/libvirt/libvirtd.log or whatever path you set for the daemon logs.
  • If the problem is related to a domain attach /var/log/libvirt/qemu/$dom.log then. Or substitute qemu with whatever hypervisor you are using.
  • If you are asked for client logs, /tmp/libvirt_client.log.