aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/sos/plugins/general.py19
-rw-r--r--src/lib/sos/plugins/system.py1
2 files changed, 11 insertions, 9 deletions
diff --git a/src/lib/sos/plugins/general.py b/src/lib/sos/plugins/general.py
index 671a54dc..44e81c1a 100644
--- a/src/lib/sos/plugins/general.py
+++ b/src/lib/sos/plugins/general.py
@@ -22,10 +22,9 @@ class general(sos.plugintools.PluginBase):
"""
optionList = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15),
- ("all_logs", "collect all log files defined in syslog.conf", "", False)
+ ("all_logs", "collect all log files defined in syslog.conf", "", False),
("sanitize", "scrub hostname/ip's from log files", "", False)]
- rhelver = self.policy().rhelVersion()
hostname = commands.getoutput("/bin/hostname")
def setup(self):
@@ -50,11 +49,12 @@ class general(sos.plugintools.PluginBase):
self.collectExtOutput("/usr/bin/uptime", root_symlink = "uptime")
if self.getOption('all_logs'):
- if self.rhelver == 5 or self.rhelver == 4:
+ rhelver = self.policy().rhelVersion()
+ if rhelver == 5 or rhelver == 4:
logs=self.doRegexFindAll(r"^\S+\s+(\/.*log.*)\s+$", "/etc/syslog.conf")
- for i in logs:
- if not os.path.isfile(i): continue
- self.addCopySpec(i)
+ for i in logs:
+ if not os.path.isfile(i): continue
+ self.addCopySpec(i)
return
@@ -63,11 +63,12 @@ class general(sos.plugintools.PluginBase):
# sanitize ip's, hostnames in logs
if self.getOption('sanitize'):
- if self.rhelver == 5 or self.rhelver == 4:
+ rhelver = self.policy().rhelVersion()
+ if rhelver == 5 or rhelver == 4:
logs=self.doRegexFindAll(r"^\S+\s+(\/.*log.*)\s+$", "/etc/syslog.conf")
else:
logs=self.doRegexFindAll(r"^\S+\s+(\/.*log.*)\s+$", "/etc/rsyslog.conf")
for log in logs:
- self.doRegexSub(log, r"(\s*%s)\S+" % (self.hostname,), r"\1sanitized-hostname")
- self.doRegexSub(log, r"([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\})", r"\1sanitized-ip")
+ self.doRegexSub(log, r"\s+(%s.*)" % (self.hostname,), r"\1sanitized-hostname")
+ self.doRegexSub(log, r"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", r"\1sanitized-ip")
return
diff --git a/src/lib/sos/plugins/system.py b/src/lib/sos/plugins/system.py
index 8a19fcd1..82b04604 100644
--- a/src/lib/sos/plugins/system.py
+++ b/src/lib/sos/plugins/system.py
@@ -24,6 +24,7 @@ class system(sos.plugintools.PluginBase):
self.addCopySpec("/var/spool/cron*")
self.addCopySpec("/var/log/cron*")
self.addCopySpec("/etc/syslog.conf")
+ self.addCopySpec("/etc/rsyslog.conf")
self.addCopySpec("/etc/ntp.conf")
self.addCopySpec("/etc/ntp/step-tickers")
self.addCopySpec("/etc/ntp/ntpservers")