コード例 #1
0
    def testWindowSize(self):
        """Test that larger window sizes sort less well-ordered logs"""
        # this log should not sort with the window size set to 100
        buf = magpie.GZipLogFile(TESTLOG2, window_size=100)
        self.failIfEqual(is_sorted(buf), 'Sorted')

        # it should sort with a window size of 200
        buf = magpie.GZipLogFile(TESTLOG2, window_size=150)
        self.failUnlessEqual(is_sorted(buf), 'Sorted')
コード例 #2
0
    def testLogParse(self):
        log = magpie.GZipLogFile(TESTLOG, line_class=magpie.ApacheLogLine)
        uas = set()
        for l in log:
            uas.add(l.ua)

        # 58 is confirmed by running
        # gunzip -c tests/logs/testlog1.gz | sed -e 's/.*[1-5][0-9][0-9] [0-9-][0-9]* "[^"]*" "\([^"]*\)".*/\1/' | sort -u | wc -l
        self.failUnlessEqual(len(uas), 58)
コード例 #3
0
 def setUp(self):
     self.log = magpie.GZipLogFile(S3_TESTLOG, line_class=magpie.S3LogLine)
コード例 #4
0
 def setUp(self):
     log1 = magpie.GZipLogFile(TESTLOG)
     log2 = magpie.GZipLogFile(TESTLOG2)
     self.merged = merge(log1, log2)
コード例 #5
0
 def setUp(self):
     self.log = magpie.GZipLogFile(TESTLOG)
コード例 #6
0
 def testSortLog(self):
     """Tests that a buffered log is in monotonically increasing date order"""
     buf = magpie.GZipLogFile(TESTLOG)
     self.failUnless(is_sorted(buf))
コード例 #7
0
 def testBufferLog(self):
     """Tests that the log buffer extracts lines"""
     buf = magpie.GZipLogFile(TESTLOG)
     self.failIfEqual(count_lines(buf), 0)