aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Quigley <bryan.quigley@canonical.com>2015-07-06 17:31:59 -0400
committerAdam Stokes <adam.stokes@ubuntu.com>2015-07-12 13:50:12 -0400
commitec3d45932ceed854678b19884d6fee62b8b53b3e (patch)
treede02dfb487be219750c1666364a46ce67179aebd
parent806267fbfef16d7c1e28553e116767e7fa167318 (diff)
downloadsos-ec3d45932ceed854678b19884d6fee62b8b53b3e.tar.gz
[juju] Update log collection to have limits
Juju can name files differently depending on the deployment so we need iterate over all the files and capture at least some of them all. At the same time the files can get quite big so we need to be able to limit their size. Now captures upstart/juju-db.log which is usually quite small. Juju local is usually used for testing so we just capture all-machines.log for that (format /var/log/juju-name-name/) Lastly we capture the ls of all of the key directories just in case we missed something. Closes #593 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
-rw-r--r--sos/plugins/juju.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/sos/plugins/juju.py b/sos/plugins/juju.py
index 98edadcd..13f797f0 100644
--- a/sos/plugins/juju.py
+++ b/sos/plugins/juju.py
@@ -14,6 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+import os
from sos.plugins import Plugin, UbuntuPlugin
from json import loads as json_load
@@ -76,9 +77,28 @@ class Juju(Plugin, UbuntuPlugin):
def setup(self):
self.add_copy_spec([
- "/var/log/juju",
"/var/lib/juju"
])
+ limit = self.get_option("log_size")
+ self.add_copy_spec_limit("/var/log/upstart/juju-db.log",
+ sizelimit=limit)
+ self.add_copy_spec_limit("/var/log/upstart/juju-db.log.1",
+ sizelimit=limit)
+ if not self.get_option("all_logs"):
+ # Capture the last bit of all files
+ for filename in os.listdir("/var/log/juju/"):
+ if filename.endswith(".log"):
+ fullname = "/var/log/juju/" + filename
+ self.add_copy_spec_limit(fullname, sizelimit=limit)
+ # Do just the all-machines from juju local
+ self.add_copy_spec_limit("/var/log/juju-*/all-machines.log",
+ sizelimit=limit)
+ self.add_cmd_output('ls -alRh /var/log/juju*')
+ else:
+ self.add_copy_spec([
+ "/var/log/juju",
+ "/var/log/juju-*"
+ ])
self.add_cmd_output([
"juju -v status",