Blob Blame History Raw
commit 3aa158a35a4e7fe4d370c254c320455081e3b1cb
Author: Bryn M. Reeves <bmr@redhat.com>
Date:   Tue Oct 29 14:43:02 2013 +0000

    Move sar data colletion to sar plug-in
    
    Historically the general plug-in collected the content of the
    /var/log/sa directory while a separate sar plug-in handles the text
    formatted summary files.
    
    This makes little sense and adds to the bloat in the "general"
    module; move the collection to the sar plug-in itself.
    
    Signed-off-by: Bryn M. Reeves <bmr@redhat.com>

diff --git a/sos/plugins/general.py b/sos/plugins/general.py
index fbf3991..d7059e6 100644
--- a/sos/plugins/general.py
+++ b/sos/plugins/general.py
@@ -28,7 +28,6 @@ class General(Plugin):
             "/etc/sos.conf",
             "/etc/sysconfig",
             "/proc/stat",
-            "/var/log/sa",
             "/var/log/pm/suspend.log",
             "/var/log/up2date",
             "/etc/hostid",
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index c09055c..6c09323 100644
--- a/sos/plugins/sar.py
+++ b/sos/plugins/sar.py
@@ -33,6 +33,7 @@ class Sar(Plugin,):
         return True
 
     def setup(self):
+        self.add_copy_spec("/var/log/sa")
         dirList = os.listdir(self.sa_path)
         # find all the sa file that don't have an existing sar file
         for fname in dirList:
commit d51a2b5e3c07ddc986c41e1494dabc852d224873
Author: Bryn M. Reeves <bmr@redhat.com>
Date:   Tue Oct 29 14:53:53 2013 +0000

    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>

diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index 6c09323..4f89b53 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: