From 10bb3b2d6f6817bb4ae96ba58865bff294e54f8d Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Thu, 17 May 2018 16:43:58 -0400 Subject: [openvswitch] Add additional logging paths. Openvswitch's logs can be located in alternate paths depending on the installation. OpenStack installations, for instance, do not use the same directories for logs as typical package installations. Related: #1259 Signed-off-by: Mark Michelson Signed-off-by: Bryn M. Reeves --- sos/plugins/openvswitch.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sos/plugins/openvswitch.py b/sos/plugins/openvswitch.py index 6f1b41ac..ab908fbc 100644 --- a/sos/plugins/openvswitch.py +++ b/sos/plugins/openvswitch.py @@ -16,6 +16,9 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from os.path import join as path_join +from os import environ + class OpenVSwitch(Plugin): """ OpenVSwitch networking @@ -28,12 +31,22 @@ class OpenVSwitch(Plugin): all_logs = self.get_option("all_logs") limit = self.get_option("log_size") + log_dirs = [ + '/var/log/containers/openvswitch/', + '/var/log/openvswitch/', + '/usr/local/var/log/openvswitch/', + ] + + if environ.get('OVS_LOGDIR'): + log_dirs.append(environ.get('OVS_LOGDIR')) + if not all_logs: - self.add_copy_spec("/var/log/openvswitch/*.log", + self.add_copy_spec([path_join(ld, '*.log') for ld in log_dirs], sizelimit=limit) - else: - self.add_copy_spec("/var/log/openvswitch/", + self.add_copy_spec([path_join(ld, '*.log') for ld in log_dirs], sizelimit=limit) + else: + self.add_copy_spec(log_dirs, sizelimit=limit) self.add_copy_spec([ "/var/run/openvswitch/ovsdb-server.pid", -- cgit