aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCoty Sutherland <csutherl@redhat.com>2016-06-15 09:21:38 -0400
committerBryn M. Reeves <bmr@redhat.com>2016-06-29 14:07:21 +0100
commitc5e1bd7410eaf2deeb9267eeffef8bb9d151b5e8 (patch)
treed4c88b28d5e13228414c75370b6d46255da7ed2d
parentf2d8b81061fa55a686b30e3303d27aa92bde036f (diff)
downloadsos-c5e1bd7410eaf2deeb9267eeffef8bb9d151b5e8.tar.gz
[tomcat] Added collection of all tomcat* logs
Optionally collect all tomcat logs, in addition to catalina.out, with the use of the --all-logs option and update tomcat paths for versions 7 and 8 (as packaged in Red Hat JBoss). Resolves #836. Signed-off-by: Coty Sutherland <csutherl@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/tomcat.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/sos/plugins/tomcat.py b/sos/plugins/tomcat.py
index fe7bab89..0ee5ca83 100644
--- a/sos/plugins/tomcat.py
+++ b/sos/plugins/tomcat.py
@@ -13,6 +13,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
+from datetime import datetime
class Tomcat(Plugin, RedHatPlugin):
@@ -22,19 +23,39 @@ class Tomcat(Plugin, RedHatPlugin):
plugin_name = 'tomcat'
profiles = ('webserver', 'java', 'services', 'sysmgmt')
- packages = ('tomcat6', 'tomcat')
+ packages = ('tomcat', 'tomcat6', 'tomcat7', 'tomcat8')
def setup(self):
self.add_copy_spec([
"/etc/tomcat",
- "/etc/tomcat6"
+ "/etc/tomcat6",
+ "/etc/tomcat7",
+ "/etc/tomcat8"
])
limit = self.get_option("log_size")
- log_glob = "/var/log/tomcat*/catalina.out"
- self.add_copy_spec_limit(log_glob, sizelimit=limit)
+
+ if not self.get_option("all_logs"):
+ log_glob = "/var/log/tomcat*/catalina.out"
+ self.add_copy_spec_limit(log_glob, sizelimit=limit)
+
+ # get today's date in iso format so that days/months below 10
+ # prepend 0
+ today = datetime.date(datetime.now()).isoformat()
+ log_glob = "/var/log/tomcat*/catalina.%s.log" % today
+ self.add_copy_spec_limit(log_glob, sizelimit=limit)
+ else:
+ self.add_copy_spec("/var/log/tomcat*/*")
def postproc(self):
+ serverXmlPasswordAttributes = ['keyPass', 'keystorePass',
+ 'truststorePass', 'SSLPassword']
+ for attr in serverXmlPasswordAttributes:
+ self.do_path_regex_sub(
+ r"\/etc\/tomcat.*\/server.xml",
+ r"%s=(\S*)" % attr,
+ r'%s="********"' % attr
+ )
self.do_path_regex_sub(
r"\/etc\/tomcat.*\/tomcat-users.xml",
r"password=(\S*)",