aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-10-29 14:53:53 +0000
committerBryn M. Reeves <bmr@redhat.com>2013-10-29 14:54:37 +0000
commitebebbf15e7548e687af043e56e5fa9a81589fd07 (patch)
treef39c5a44e48c7cb90eb482f1da72dfa2a71938c8
parentcd942f5deb2d56eecf98016bcdd5a7a626ab2bdb (diff)
downloadsos-ebebbf15e7548e687af043e56e5fa9a81589fd07.tar.gz
Limit default sar data collection
By default the general module will scoop up all files under the /var/log/sa directory. With some configurations this path could contain many GB of data. Use add_copy_spec_limit() by default for sar data and add a new option sar.all_sar=False to allow the user to override this. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/sar.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index 6c093237..4f89b533 100644
--- a/sos/plugins/sar.py
+++ b/sos/plugins/sar.py
@@ -23,6 +23,10 @@ class Sar(Plugin,):
packages = ('sysstat',)
sa_path = '/var/log/sa'
+ option_list = [("all_sar", "gather all system activity records", "", False)]
+
+ # size-limit SAR data collected by default (MB)
+ sa_size = 20
def check_enabled(self):
# check to see if we are force-enabled with no sar installation
@@ -33,7 +37,13 @@ class Sar(Plugin,):
return True
def setup(self):
- self.add_copy_spec("/var/log/sa")
+ if self.get_option("all_sar"):
+ self.sa_size = 0
+
+ self.add_copy_spec_limit("/var/log/sa/sar[0-9]*",
+ sizelimit = self.sa_size)
+ self.add_copy_spec_limit("/var/log/sa/sa[0-9]*",
+ sizelimit = self.sa_size)
dirList = os.listdir(self.sa_path)
# find all the sa file that don't have an existing sar file
for fname in dirList: