[libvirt] Open monitor logs O_APPEND

Hi, attached patch is from Debian Bug #507553: The logfile is opened with O_APPEND (to make logrotate work with copytruncate) and without O_TRUNC (to not lose log information e.g. with stop and start of a VM). Using collectd or munin to monitor VMs creates quiet a bit of qemu monitor output so the ability to use logrotate makes a lot of sense to me. O.k. to apply? -- Guido diff -ur libvirt-0.4.4.orig/src/qemu_driver.c libvirt-0.4.4/src/qemu_driver.c --- libvirt-0.4.4.orig/src/qemu_driver.c 2008-06-12 16:52:53.000000000 +0200 +++ libvirt-0.4.4/src/qemu_driver.c 2008-12-02 12:48:32.271881000 +0100 @@ -844,7 +844,7 @@ return -1; } - if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY, + if ((vm->logfile = open(logfile, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR)) < 0) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, _("failed to create logfile %s: %s"),

On Thu, Dec 04, 2008 at 02:11:07PM +0100, Guido G?nther wrote:
Hi, attached patch is from Debian Bug #507553:
The logfile is opened with O_APPEND (to make logrotate work with copytruncate) and without O_TRUNC (to not lose log information e.g. with stop and start of a VM).
Using collectd or munin to monitor VMs creates quiet a bit of qemu monitor output so the ability to use logrotate makes a lot of sense to me.
And is there a corresponding logrotate config file from Debian we can use ? If we're going to let log files append, then we need to ship a logrotate config by default too. ACK if we add a logrotate config too Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Dec 04, 2008 at 02:11:07PM +0100, Guido G?nther wrote:
Hi, attached patch is from Debian Bug #507553:
The logfile is opened with O_APPEND (to make logrotate work with copytruncate) and without O_TRUNC (to not lose log information e.g. with stop and start of a VM).
Using collectd or munin to monitor VMs creates quiet a bit of qemu monitor output so the ability to use logrotate makes a lot of sense to me.
And is there a corresponding logrotate config file from Debian we can use ? If we're going to let log files append, then we need to ship a logrotate config by default too. I've changed the patch to only use O_APPEND as root so we don't fill up
On Thu, Dec 04, 2008 at 01:26:40PM +0000, Daniel P. Berrange wrote: the user's log when running as qemu:///session
ACK if we add a logrotate config too New version attached. O.k. to apply? -- Guido

On Thu, Dec 04, 2008 at 05:44:30PM +0100, Guido Günther wrote:
On Thu, Dec 04, 2008 at 02:11:07PM +0100, Guido G?nther wrote:
Hi, attached patch is from Debian Bug #507553:
The logfile is opened with O_APPEND (to make logrotate work with copytruncate) and without O_TRUNC (to not lose log information e.g. with stop and start of a VM).
Using collectd or munin to monitor VMs creates quiet a bit of qemu monitor output so the ability to use logrotate makes a lot of sense to me.
And is there a corresponding logrotate config file from Debian we can use ? If we're going to let log files append, then we need to ship a logrotate config by default too. I've changed the patch to only use O_APPEND as root so we don't fill up
On Thu, Dec 04, 2008 at 01:26:40PM +0000, Daniel P. Berrange wrote: the user's log when running as qemu:///session
ACK if we add a logrotate config too New version attached. O.k. to apply?
Looks fine to me, we will need to update the spec file but that can be done later, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Fri, Dec 05, 2008 at 02:20:08PM +0100, Daniel Veillard wrote:
On Thu, Dec 04, 2008 at 05:44:30PM +0100, Guido Günther wrote:
On Thu, Dec 04, 2008 at 02:11:07PM +0100, Guido G?nther wrote:
Hi, attached patch is from Debian Bug #507553:
The logfile is opened with O_APPEND (to make logrotate work with copytruncate) and without O_TRUNC (to not lose log information e.g. with stop and start of a VM).
Using collectd or munin to monitor VMs creates quiet a bit of qemu monitor output so the ability to use logrotate makes a lot of sense to me.
And is there a corresponding logrotate config file from Debian we can use ? If we're going to let log files append, then we need to ship a logrotate config by default too. I've changed the patch to only use O_APPEND as root so we don't fill up
On Thu, Dec 04, 2008 at 01:26:40PM +0000, Daniel P. Berrange wrote: the user's log when running as qemu:///session
ACK if we add a logrotate config too New version attached. O.k. to apply?
Looks fine to me, we will need to update the spec file but that can be done later, Applied now with one minor change: we create the logdir now during "make install" since logrotate otherwise complains about the missing dir. Cheers, -- Guido
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Guido Günther