diff options
author | Gurucharan Shetty <gshetty@nicira.com> | 2013-02-13 19:17:42 -0800 |
---|---|---|
committer | Gurucharan Shetty <gshetty@nicira.com> | 2013-02-14 14:14:33 -0800 |
commit | ced171980cbe8c9eb430e920ff6854287831c335 (patch) | |
tree | 7be2f845c2e188922bcbe4b1d0e55fc9d0606cf8 /utilities | |
parent | 659fd90c570487b9b7a2f37dddf30a7eced927d4 (diff) | |
download | openvswitch-ced171980cbe8c9eb430e920ff6854287831c335.tar.gz |
ovs-bugtool: Ability to collect the number of rotated logs.
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@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r-- | utilities/bugtool/ovs-bugtool.8.in | 11 | ||||
-rwxr-xr-x | 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 a1e653be2..b528dbaeb 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 1e78b5c58..3461735ea 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]) |