11

I had a qemu virtual-machine which crashed several times because HDD in hypervisor had no space left. This made me wonder is there a possibility to to set up a logging/debugging for quemu virtual-machines. I tried to start virtual-machine with -D /tmp/qemu-debug-log command:

qemu-system-i386 -D /tmp/qemu-debug-log -monitor pty -device e1000,netdev=tap0 -netdev tap,id=tap0 -m 512M -display vnc=:1 -drive file=FreeBSD10.2

..but this did not even create a /tmp/qemu-debug-log file.

In addition, qemu does not seem to write into messages or kernel ring buffer(dmesg). What are the best practices to enable logging for qemu virtual machines?

  • Have you tried to use libvirt's functions instead? – Willian Paixao Oct 27 '15 at 20:26
  • I would prefer to work with qemu directly and not through tools which use libvirt which in turn should use libvirt qemu driver. – Martin Oct 30 '15 at 14:43
10
+50

qemu command accepts a simple -d switch which creates a log file called /tmp/qemu.log.

You can access more logging/debugging options via QEMU Monitor (e.g. qemu -monitor stdio).

3

Any logging option provided by QEMU will be far too low-level for what you need: your problem is not that the virtual hardware is misbehaving, only that the software inside the VM needs attention.

In this respect a VM is no different to a real machine, and the solution is the same. Your question suggests that the VM is running FreeBSD, so you should check out using rsyslog to push the logs to an external syslog server (which could be your host machine) via the network connection.

(I'm not very familiar with the BSDs, so I'm not 100% certain that rsyslog is the right or only solution here, but that keyword should get you started.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.