Bug 234594

Summary: Xen daemon debug & qemu logs are not rotated
Product: [Fedora] Fedora Reporter: Mark McLoughlin <markmc>
Component: xenAssignee: Daniel Berrangé <berrange>
Status: CLOSED RAWHIDE QA Contact: Martin Jenner <mjenner>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: bstein, katzj, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-24 23:24:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
xen-logrotate.patch none

Description Mark McLoughlin 2007-03-30 13:48:54 UTC
+++ This bug was initially created as a clone of Bug #216239 +++

Description of problem:
XenD creates a number of log files under /var/log/xen. Only the xend.log file is
ever rotated - it uses python's builtin logging infrastructure to rotate. The
other files xend-debug.log and qemu-dm*.log are never rotated. The qemu-dm-*.log
are creted based on the PID of the QEMU process, so an ever increasing number of
log files accumulate over time.

Version-Release number of selected component (if applicable):
xen-3.0.3-8.el5

How reproducible:
Always

Steps to Reproduce:
1. Work with Xen on a machine for 6 months
2.
3.
  
Actual results:
Huge & large numbers of log files under /var/log/xen

Expected results:
A small number of logs of limited size 

Additional info:
Attaching a logrotate config file from OpenSuse Xen RP mthat would be a good
starting point for a fix.

-- Additional comment from berrange on 2006-11-17 17:15 EST --
Created an attachment (id=141542)
Log rotate config file

Comment 1 Mark McLoughlin 2007-03-30 13:50:09 UTC
Sounds reasonable, might change the logrotate config a little and try and get it
upstream too

Comment 2 Daniel Berrangé 2007-04-24 17:53:53 UTC
Mark - any specific changes you think are relevant ? If not I'll just add the
attached logrotate file to the rawhide Xen RPM as is.


Comment 3 Mark McLoughlin 2007-05-04 14:31:07 UTC
 - We shouldn't logrotate xend.log, since xend already rotates it .. doing it
   twice with the same rotate config would just lead to weirdness

 - I'd leave xend-debug.log to the default policy in logrotate.conf - e.g.
   rotate weekly with 4 backups. It generally doesn't contain very useful stuff
   and would take a long time to build up to 1M.

 - copytruncate is what we want here since we can't get xend to close and 
   re-open xend-debug.log (since it's xend's stdout/stderr)

 - Not sure what to do about qemu-dm.*.log - maybe deleting them monthly as
   you suggest is enough, if you start a guest early on the first of the month
   and the logfile is immediately deleted while the guest is still running? I'd
   suggest that tmpwatch is what we really want here.

 - We should deal with xen-hotplug.log and domain-builder-ng.log in the same
   way as xend-debug.log. copytruncate is again needed for domain-builder-ng.log
   since xend (through libxc) will hold this file open. copytruncate isn't
   needed for xen-hotplug.log since it's only written to by short-lived 
   processes, but it's no harm really.

So, I suggest simply this:

/var/log/xen/xend-debug.log /var/log/xen/xen-hotplug-common.sh
/var/log/xen/domain-builder-ng.log {
    notifempty
    missingok
    copytruncate
}

Comment 4 Mark McLoughlin 2007-05-04 14:35:41 UTC
Hmm, typo:

/var/log/xen/xend-debug.log /var/log/xen/xen-hotplug.log
/var/log/xen/domain-builder-ng.log {
    notifempty
    missingok
    copytruncate
}


Comment 5 Mark McLoughlin 2007-05-04 16:18:10 UTC
Created attachment 154135 [details]
xen-logrotate.patch

Comment 6 Mark McLoughlin 2007-05-04 16:20:12 UTC
Okay, to do the tmpwatch thing with qemu-dm, we'd have to move the logs into a
dir of their own. Let's just do the monthly thing.

Re-assigning to dan to include in the next build ...

Don't forget to mark it %config(noreplace)

Comment 7 Red Hat Bugzilla 2007-07-25 00:06:52 UTC
change QA contact

Comment 8 Daniel Berrangé 2007-09-24 23:24:13 UTC
Addressed in rawhide

* Tue Jun 12 2007 Daniel P. Berrange <berrange> - 3.1.0-2.fc8
- Add logrotate configuration for all xen related logs