aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorastokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-01-11 21:14:30 +0000
committerastokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-01-11 21:14:30 +0000
commit09e8e83472f8ef32e419e3542a6bd725f4d49e3d (patch)
tree5286e20df6ba2070b6977a79ab080532e9f8d9c0 /src
parentc57c19583fa21ca3dc0d8f388aceb4085e5157c0 (diff)
downloadsos-09e8e83472f8ef32e419e3542a6bd725f4d49e3d.tar.gz
general plugin to sanitize logs finished, fixme: broken copiedfiles list within postproc?!?!
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@675 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src')
-rw-r--r--src/lib/sos/plugins/general.py19
-rw-r--r--src/lib/sos/plugins/system.py1
-rw-r--r--src/sos.spec6
3 files changed, 16 insertions, 10 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")
diff --git a/src/sos.spec b/src/sos.spec
index 19a64515..96d3169e 100644
--- a/src/sos.spec
+++ b/src/sos.spec
@@ -3,7 +3,7 @@
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 1.8
-Release: 20%{?dist}
+Release: 21%{?dist}
Group: Applications/System
Source0: https://fedorahosted.org/releases/s/o/sos/%{name}-%{version}.tar.gz
License: GPLv2+
@@ -53,6 +53,10 @@ rm -rf ${RPM_BUILD_ROOT}
%config %{_sysconfdir}/sos.conf
%changelog
+* Mon Jan 11 2010 Adam Stokes <ajs at redhat dot com> = 1.8-21
+- more sanitizing options for log files
+- rhbz fixes from RHEL version merged into trunk
+
* Tue Nov 19 2009 Adam Stokes <ajs at redhat dot com> = 1.8-20
- dont copy unwanted files due to symlinks
- More plugin enhancements