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')
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)
def setUp(self): self.log = magpie.GZipLogFile(S3_TESTLOG, line_class=magpie.S3LogLine)
def setUp(self): log1 = magpie.GZipLogFile(TESTLOG) log2 = magpie.GZipLogFile(TESTLOG2) self.merged = merge(log1, log2)
def setUp(self): self.log = magpie.GZipLogFile(TESTLOG)
def testSortLog(self): """Tests that a buffered log is in monotonically increasing date order""" buf = magpie.GZipLogFile(TESTLOG) self.failUnless(is_sorted(buf))
def testBufferLog(self): """Tests that the log buffer extracts lines""" buf = magpie.GZipLogFile(TESTLOG) self.failIfEqual(count_lines(buf), 0)