Bug 928217 - Vdsm logs are filling filesystem up - logrotation of vdsm logs doesn't work correctly
Summary: Vdsm logs are filling filesystem up - logrotation of vdsm logs doesn't work c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: vdsm
Version: 3.1.3
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: ---
: 3.2.0
Assignee: Douglas Schilling Landgraf
QA Contact: Artyom
URL:
Whiteboard: infra
Depends On:
Blocks: 951612
TreeView+ depends on / blocked
 
Reported: 2013-03-27 07:51 UTC by Tomas Dosek
Modified: 2022-07-09 05:58 UTC (History)
22 users (show)

Fixed In Version: vdsm-4.10.2.19.0
Doc Type: Bug Fix
Doc Text:
Previously, VDSM used FileHandler to manage the logs. FileHandler was replaced with WatchedFileHandler but /var/log/vdsm/libvirt.log was not included in WatchedFileHandler. This caused /var/log/vdsm/libvirt.log to expand endlessly, which led to cases in which the RHEV-H file system could fill with the libvirt log. libvirt.log has been removed, eliminating any chance that the RHEV-H filesystem could be filled with it.
Clone Of:
: 951612 (view as bug list)
Environment:
Last Closed: 2013-06-10 20:46:51 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-47077 0 None None None 2022-07-09 05:58:35 UTC
Red Hat Knowledge Base (Solution) 340123 0 None None None Never
Red Hat Product Errata RHSA-2013:0886 0 normal SHIPPED_LIVE Moderate: rhev 3.2 - vdsm security and bug fix update 2013-06-11 00:25:02 UTC
oVirt gerrit 13728 0 None MERGED vdsmd.init.in: removing /var/log/vdsm/libvirt.log 2021-02-17 15:58:55 UTC

Description Tomas Dosek 2013-03-27 07:51:16 UTC
Description of problem:

Vdsm logs are by default not properly rotated which causes the filesystem of hosts to fill up pretty easily. 

This is an issue especially with hosts that are configured just with disk space large enough only for hosts installation + few GB of logs (i.e. installation of host on SD card)

Version-Release number of selected component (if applicable):
4.10.*

How reproducible:
100 %

Steps to Reproduce:
1. Have a host with heavy load on it and few hundred VMs and just 12 GB of disk space.
  
Actual results:
Host filesystem is getting filled up by vdsm logs pretty easily, vdsm log size seems to be unlimited

Expected results:
logrotation should work correctly and host filesystem should not fill up

Additional info:

[root@i-mpapp1 ~]# lsof -a +L1 /var
COMMAND  PID USER   FD   TYPE  DEVICE   SIZE/OFF NLINK   NODE NAME
vdsm    9581 vdsm   12w   REG 253,137 3725208820     0 131486 /var/log/vdsm/libvirt.log.1 (deleted)
python  9601 root    4r   REG 253,137   17369349     0 131698 /var/log/vdsm/vdsm.log.1 (deleted)


Blamed git change:


New vdsm 4.10.* packages have removed "copytruncate" from /etc/logrotate.d/vdsm:

@@ -1,7 +1,6 @@
 /var/log/vdsm/*.log {
     rotate 100
     missingok
-    copytruncate
     size 15M
     compress
     compresscmd /usr/bin/xz


Apparently it's not needed any more: from ChangeLog:

2012-05-18  Mark Wu  <wudxw.ibm.com>

        Change to use WatchedFileHandler instead of FileHandler in logger.conf
        We find that no new log message appears in log file after manually changing
        the vdsm log when vdsm is running. We have to restart vdsm to get logging
        work again. It could happen when people try to add some markers to pinpoint
        the related messages during toubleshooting. It's caused by the log file gets
        associated with a new inode after the manual change. To make logging survive
        the change, use WatchedFileHandler instead of FileHandler.

        In addition, WatchedFileHandler was provided specially for the external
        log rotate tools. It can notice that the log file change performed by
        logrotate, so we don't need to have the option 'copytruncate' in
        vdsm-logrotate.conf any more.

        Reported-by: Changming Bai <baichm.ibm.com>


In etc/vdsm/logger.conf :
@@ -37,19 +37,20 @@
 propagate=0
 
 [handler_syslog]
+level=WARNING
 class=handlers.SysLogHandler
 formatter=sysform
-args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
+args=('/dev/log', handlers.SysLogHandler.LOG_USER)
 
 [handler_logfile]
-class=FileHandler
+class=logging.handlers.WatchedFileHandler
 args=('/var/log/vdsm/vdsm.log',)
 filters=storage.misc.TracebackRepeatFilter
 level=DEBUG
 formatter=long
 
 [handler_metadata]
-class=FileHandler
+class=logging.handlers.WatchedFileHandler
 args=('/var/log/vdsm/metadata.log',)
 level=WARNING
 formatter=long
@@ -69,7 +70,7 @@
 format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::(%(funcName)s) %(message)s

Comment 7 Douglas Schilling Landgraf 2013-04-01 22:19:34 UTC
Hi all,

Thanks for your help
I have sent a patch to vdsm upstream to add the entry copytruncate to logrotate vdsm file avoiding to keep increasing the log forever because vdsm keep it opened.

Until next rhev-h version, I could suggest the following steps:

# vi /etc/logrotate.d/vdsm
- Add the entry:
copytruncate

# persist /etc/logrotate.d/vdsm

Restart vdsm daemon.

Cheers
Douglas

Comment 8 Douglas Schilling Landgraf 2013-04-02 12:56:03 UTC
Hello,

I have sent another patch upstream to change the rotation of logs.

===============
Logrotate compress VDSM logs (/var/log/vdsm/*) when they achieve >15M.
However, we rotates the logs only when it reaches 100 count.

This patch purpose the rotation to 10 counts because very old logs
cannot help to get out of trouble anyway. Also, reduce the number of
files/space in the partition.

Rotating 10 files compressed seems reasonable/safe.

http://gerrit.ovirt.org/#/c/13500/
=========================

Should we use more then 10 files rotating? 


Thanks
Douglas

Comment 9 Julio Entrena Perez 2013-04-02 13:09:07 UTC
(In reply to comment #8)

> Should we use more then 10 files rotating? 

Imvho we should keep a bit more than 10 files by default.
Current high vdsm verbosity means I sometimes end up looking at vdsm.log.30.xz to find the info I need.

Comment 10 Marina Kalinin 2013-04-02 15:29:18 UTC
(In reply to comment #9)
> (In reply to comment #8)
> 
> > Should we use more then 10 files rotating? 
> 
> Imvho we should keep a bit more than 10 files by default.
> Current high vdsm verbosity means I sometimes end up looking at
> vdsm.log.30.xz to find the info I need.

I agree.

Comment 17 Artyom 2013-05-06 11:41:09 UTC
libvirtd logs saved under /var/log directory and not under /var/log/vdsm

libvirt-0.10.2-18.el6_4.4
vdsm-4.10.2-17.0.el6ev
sf15

Comment 19 Artyom 2013-05-16 07:04:31 UTC
libvirtd logs saved under /var/log directory and not under /var/log/vdsm

libvirt-0.10.2-18.el6_4.4
vdsm-4.10.2-18.0.el6ev
sf16

Comment 21 errata-xmlrpc 2013-06-10 20:46:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0886.html


Note You need to log in before you can comment on or make changes to this bug.