
On 02/02/2011, at 4:23 AM, Daniel P. Berrange wrote:
On Tue, Feb 01, 2011 at 08:45:41AM -0800, Ed Swierk wrote:
When troubleshooting a libvirt system the most obvious question I face is when a given VM started and stopped.
The only way I've been able to obtain this information is by setting log_level = 1 in libvirtd.conf, which turns on the firehose, generating an enormous amount of output. I then have to sift through the logs for magic strings like "virExecWithHook" to see when a VM started, and "Shutting down VM" to see when a VM stopped. Is there no concise message that indicates a VM starting up? "virExecWithHook" doesn't exactly jump out.
I'd consider starting up and shutting down a VM to be at least worth an info-level message in the log. I monkeyed with the log_filters setting but I couldn't figure out how to filter those two strings. Any hints?
In latest libvirt we write to the audit logs when a VM starts or stop, and upon hotplug of nics & disks (see /var/log/audit/audit.log)
This sounds like the kind of thing that could be monitored pretty effectively with the hook scripts too. http://justinclift.fedorapeople.org/libvirt_website/hooks.html (sorry for the non libvirt.org URL, main site appears to be down atm) I'm thinking "add a /etc/libvirt/hooks/qemu script" and make it output updated vm state somewhere useful to you?