[ovs-dev] [PATCH 3/6] ovs-bugtool: Ability to collect the number of rotated logs.

Gurucharan Shetty shettyg at nicira.com
Thu Feb 14 21:28:18 UTC 2013


A big reason for a large debug bundle size is the size of log
files. By default we collect 20 rotated logs for each logfile.
Most of the times we collect the debug bundle as soon as we
hit a bug. In such cases, we know that we need only one day's
worth of logs.

This patch adds an option, '--log-days' to ovs-bugtool wherein
we can specify how many days worth of rotated logs do we need
as part of the debug bundle.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 utilities/bugtool/ovs-bugtool.8.in |   11 ++++++++---
 utilities/bugtool/ovs-bugtool.in   |   14 +++++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/utilities/bugtool/ovs-bugtool.8.in b/utilities/bugtool/ovs-bugtool.8.in
index a1e653b..b528dba 100644
--- a/utilities/bugtool/ovs-bugtool.8.in
+++ b/utilities/bugtool/ovs-bugtool.8.in
@@ -23,9 +23,6 @@ system and places it in \fB/var/log/ovs-bugtool\fR.
 .IP "\fB\-\-all\fR"
 Use all available capabilities.
 .
-.IP "\fB\-\-ovs\fR"
-Use only Open vSwitch relevant capabilities.
-.
 .IP "\fB\-\-capabilities\fR"
 List \fBovs\-bugtool\fR capabilities.
 .
@@ -35,10 +32,18 @@ Print verbose debugging output.
 .IP "\fB\-\-entries=\fIlist\fR"
 Use the capabilities specified in a comma-separated list.
 .
+.IP "\fB\-\-log\-days=\fIdays\fR"
+Include the logs rotated in the previous \fIdays\fR days in the debug bundle.
+The number of log files included has a big impact on the eventual bundle size.
+The default value is 20 days.
+.
 .IP "\fB\-\-output=\fIfiletype\fR"
 Generate a debug bundle with the specified file type.  Options include
 \fBtar\fR, \fBtar.gz\fR, \fBtar.bz2\fR, and \fBzip\fR.
 .
+.IP "\fB\-\-ovs\fR"
+Use only Open vSwitch relevant capabilities.
+.
 .IP "\fB\-\-silent\fR"
 Suppress output.
 .
diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index 1e78b5c..3461735 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -419,6 +419,9 @@ def main(argv=None):
     output_type = 'tar.bz2'
     output_fd = -1
 
+    # Default value for the number of rotated logs.
+    log_days = 20
+
     if argv is None:
         argv = sys.argv
 
@@ -426,7 +429,7 @@ def main(argv=None):
         (options, params) = getopt.gnu_getopt(
             argv, 'sy', ['capabilities', 'silent', 'yestoall', 'entries=',
                          'output=', 'outfd=', 'outfile=', 'all', 'unlimited',
-                         'debug', 'ovs'])
+                         'debug', 'ovs', 'log-days='])
     except getopt.GetoptError, opterr:
         print >>sys.stderr, opterr
         return 2
@@ -488,6 +491,9 @@ def main(argv=None):
             only_ovs_info = True
             collect_all_info = False
 
+        if k == '--log-days':
+            log_days = int(v) + 1
+
     if len(params) != 1:
         print >>sys.stderr, "Invalid additional arguments", str(params)
         return 2
@@ -639,8 +645,10 @@ exclude those logs from the archive.
         'ovs-xapi-sync.log', 'ovs-monitor-ipsec.log']])
     for cap, logs in [system_logs, ovs_logs]:
         file_output(cap, logs)
-        file_output(cap, ['%s.%d' % (f, n) for n in range(20) for f in logs])
-        file_output(cap, ['%s.%d.gz' % (f, n) for n in range(20) for f in logs])
+        file_output(cap,
+            ['%s.%d' % (f, n) for n in range(log_days) for f in logs])
+        file_output(cap,
+            ['%s.%d.gz' % (f, n) for n in range(log_days) for f in logs])
 
     if not os.path.exists('/var/log/dmesg') and not os.path.exists('/var/log/boot'):
         cmd_output(CAP_SYSTEM_LOGS, [DMESG])
-- 
1.7.9.5




More information about the dev mailing list