def test_004_normalizer_uuid(self): """ Verify that we get at least uuid tag """ testlog = {'raw': 'a minimal log line'} ln = LogNormalizer(self.normalizer_path) ln.lognormalize(testlog) self.assertTrue('uuid' in testlog.keys())
def test_005_normalizer_test_a_syslog_log(self): """ Verify that lognormalizer extracts syslog header as tags """ testlog = {'raw': 'Jul 18 08:55:35 naruto app[3245]: body message'} ln = LogNormalizer(self.normalizer_path) ln.lognormalize(testlog) self.assertTrue('uuid' in testlog.keys()) self.assertTrue('date' in testlog.keys()) self.assertEqual(testlog['body'], 'body message') self.assertEqual(testlog['program'], 'app') self.assertEqual(testlog['pid'], '3245')
def test_006_normalizer_test_a_syslog_log_with_syslog_deactivate(self): """ Verify that lognormalizer does not extract syslog header as tags when syslog normalizer is deactivated. """ testlog = {'raw': 'Jul 18 08:55:35 naruto app[3245]: body message'} ln = LogNormalizer(self.normalizer_path) active_n = ln.get_active_normalizers() to_deactivate = [n for n in active_n.keys() if n.find('syslog') >= 0] for n in to_deactivate: del active_n[n] ln.set_active_normalizers(active_n) ln.reload() ln.lognormalize(testlog) self.assertTrue('uuid' in testlog.keys()) self.assertFalse('date' in testlog.keys()) self.assertFalse('program' in testlog.keys())