]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
logging: ensure virtlogd rollover takes priority over logrotate
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 5 Jul 2019 09:32:53 +0000 (10:32 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 12 Jul 2019 11:44:59 +0000 (12:44 +0100)
The virtlogd config is set to rollover logs every 2 MB.

Normally a logrotate config file is also installed to handle cases where
virtlogd is disabled. This is set to rollover weekly with no size
constraint.

As a result logrotate can interfere with virtlogd's, rolling over files
that virtlogd has already taken care of.

This changes logrotate configs to rollover based on a max size
constraint of 2 MB + 1 byte. When virtlogd is running the log files will
never get this large, making logrotate a no-op.

If the user changes the size in virtlogd's config to something larger,
they are responsible for also changing the logrotate config suitably.

The LXC/libxl drivers don't use virtlogd, but there logrotate config is
altered to match the QEMU driver config, for the sake of consistency.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/logging/virtlogd.conf
src/remote/libvirtd.libxl.logrotate.in
src/remote/libvirtd.lxc.logrotate.in
src/remote/libvirtd.qemu.logrotate.in

index 72da7f07056253da7fe58dd017328e763f5e5f4a..bc41edbc6b95432b700fcfc00400dec093d8a871 100644 (file)
 #admin_max_clients = 5
 
 # Maximum file size before rolling over. Defaults to 2 MB
+#
+# Beware that a logrotate config file might be installed too,
+# to handle cases where virtlogd is disabled. To ensure that
+# the logrotate config is a no-op when virtlogd is running,
+# make sure that max_size here is smaller than size listed
+# in the logrotate config.
 #max_size = 2097152
 
 # Maximum number of backup files to keep. Defaults to 3,
index cb7f07d846dc7ae6f5adbddb957b88844d7c2fe6..1461c1efa10d87825a90255ed72f8c14722726e1 100644 (file)
@@ -1,5 +1,5 @@
 @localstatedir@/log/libvirt/libxl/*.log {
-        weekly
+        size 2097153
         missingok
         rotate 4
         compress
index 2bb9dfba121fd3cdefaec2295558a41c35fbbb15..b88dabb58e17fac8a995d18f693e365f7ffdd952 100644 (file)
@@ -1,5 +1,5 @@
 @localstatedir@/log/libvirt/lxc/*.log {
-        weekly
+        size 2097153
         missingok
         rotate 4
         compress
index cdb399ef23f654623fc5613cf9f67f94731909e9..78f2ca875ea93ce0398718c1b0fb0ee7d72efb4b 100644 (file)
@@ -1,5 +1,13 @@
 @localstatedir@/log/libvirt/qemu/*.log {
-        weekly
+        # The QEMU driver is configured to use virtlogd by
+        # default, which will perform log rollover.
+        # This logrotate config is still installed for cases
+        # where the user has switched off virtlogd.
+        #
+        # If virtlogd is active, ensure that size here is
+        # larger than 'max_size' in the virtlogd config
+        # so that logrotate becomes a no-op
+        size 2097153
         missingok
         rotate 4
         compress