예제 #1
0
 def test_severityCrit(self):
     """
     The syslog severity 'crit' is mapped to 'CRITICAL'.
     """
     eventDict = {'severity': 'crit'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('CRITICAL', eventDict['logLevel'])
예제 #2
0
 def test_categoryDefault(self):
     """
     If the category is not set, it is set to C{'syslog'}.
     """
     eventDict = {}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('syslog', eventDict['category'])
예제 #3
0
 def test_severityEmerg(self):
     """
     The syslog severity 'emerg' is mapped to 'EMERGENCY'.
     """
     eventDict = {'severity': 'emerg'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('EMERGENCY', eventDict['logLevel'])
예제 #4
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_severityCrit(self):
     """
     The syslog severity 'crit' is mapped to 'CRITICAL'.
     """
     eventDict = {'severity': 'crit'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('CRITICAL', eventDict['logLevel'])
예제 #5
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_categoryAlreadySet(self):
     """
     If the category is set, it is left unchanged.
     """
     eventDict = {'category': 'test'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('test', eventDict['category'])
예제 #6
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_severityEmerg(self):
     """
     The syslog severity 'emerg' is mapped to 'EMERGENCY'.
     """
     eventDict = {'severity': 'emerg'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('EMERGENCY', eventDict['logLevel'])
예제 #7
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_categoryDefault(self):
     """
     If the category is not set, it is set to C{'syslog'}.
     """
     eventDict = {}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('syslog', eventDict['category'])
예제 #8
0
 def test_categoryAlreadySet(self):
     """
     If the category is set, it is left unchanged.
     """
     eventDict = {'category': 'test'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('test', eventDict['category'])
예제 #9
0
 def test_hostnames(self):
     """
     A matching hostname in the hostname mapping overrides.
     """
     eventDict = {'hostname': 'test'}
     eventDict = syslog.syslogToUDPLogEvent(
         eventDict, hostnames={'test': 'test.example.org'})
     self.assertEqual('test.example.org', eventDict['hostname'])
예제 #10
0
 def test_severityWarn(self):
     """
     The syslog severity 'warn' is mapped to 'WARNING'.
     """
     eventDict = {'severity': 'warn'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('WARNING', eventDict['logLevel'])
     self.assertNotIn('severity', eventDict)
예제 #11
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_severityWarn(self):
     """
     The syslog severity 'warn' is mapped to 'WARNING'.
     """
     eventDict = {'severity': 'warn'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('WARNING', eventDict['logLevel'])
     self.assertNotIn('severity', eventDict)
예제 #12
0
 def test_severity(self):
     """
     If the syslog event has a severity, it is renamed, mapped to logLevel.
     """
     eventDict = {'severity': 'debug'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('DEBUG', eventDict['logLevel'])
     self.assertNotIn('severity', eventDict)
예제 #13
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_severity(self):
     """
     If the syslog event has a severity, it is renamed, mapped to logLevel.
     """
     eventDict = {'severity': 'debug'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('DEBUG', eventDict['logLevel'])
     self.assertNotIn('severity', eventDict)
예제 #14
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_tag(self):
     """
     If the syslog event has a tag, it is renamed to appname.
     """
     eventDict = {'tag': 'test'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('test', eventDict['appname'])
     self.assertNotIn('tag', eventDict)
예제 #15
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_severityErr(self):
     """
     The syslog severity 'err' is mapped to 'ERROR'.
     """
     eventDict = {'severity': 'err'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('ERROR', eventDict['logLevel'])
     self.assertNotIn('severity', eventDict)
예제 #16
0
 def test_tag(self):
     """
     If the syslog event has a tag, it is renamed to appname.
     """
     eventDict = {'tag': 'test'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('test', eventDict['appname'])
     self.assertNotIn('tag', eventDict)
예제 #17
0
 def test_severityErr(self):
     """
     The syslog severity 'err' is mapped to 'ERROR'.
     """
     eventDict = {'severity': 'err'}
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual('ERROR', eventDict['logLevel'])
     self.assertNotIn('severity', eventDict)
예제 #18
0
 def test_defaultHostnameNoMatch(self):
     """
     A non-matching hostname in the hostname mapping remains unchanged.
     """
     eventDict = {'hostname': 'foo'}
     eventDict = syslog.syslogToUDPLogEvent(
         eventDict, hostnames={'test': 'test.example.org'})
     self.assertEqual('foo', eventDict['hostname'])
예제 #19
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_defaultHostnameNoMatch(self):
     """
     A non-matching hostname in the hostname mapping remains unchanged.
     """
     eventDict = {'hostname': 'foo'}
     eventDict = syslog.syslogToUDPLogEvent(
         eventDict,
         hostnames={'test': 'test.example.org'})
     self.assertEqual('foo', eventDict['hostname'])
예제 #20
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_hostnames(self):
     """
     A matching hostname in the hostname mapping overrides.
     """
     eventDict = {'hostname': 'test'}
     eventDict = syslog.syslogToUDPLogEvent(
         eventDict,
         hostnames={'test': 'test.example.org'})
     self.assertEqual('test.example.org', eventDict['hostname'])
예제 #21
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_timestampSubSecond(self):
     """
     Datetimes with microseconds yield a fractional timestamp.
     """
     eventDict = {
             'timestamp': datetime.datetime(2015, 1, 15, 15, 59, 26, 341000,
                                            tzinfo=tz.tzutc())
             }
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual(1421337566.341, eventDict['timestamp'])
예제 #22
0
 def test_timestamp(self):
     """
     The event timestamp is converted to a POSIX timestamp.
     """
     eventDict = {
         'timestamp':
         datetime.datetime(2015, 1, 15, 15, 59, 26, tzinfo=tz.tzutc())
     }
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual(1421337566, eventDict['timestamp'])
예제 #23
0
파일: test_syslog.py 프로젝트: mochi/udplog
 def test_timestamp(self):
     """
     The event timestamp is converted to a POSIX timestamp.
     """
     eventDict = {
             'timestamp': datetime.datetime(2015, 1, 15, 15, 59, 26,
                                            tzinfo=tz.tzutc())
             }
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual(1421337566, eventDict['timestamp'])
예제 #24
0
 def test_timestampSubSecond(self):
     """
     Datetimes with microseconds yield a fractional timestamp.
     """
     eventDict = {
         'timestamp':
         datetime.datetime(2015,
                           1,
                           15,
                           15,
                           59,
                           26,
                           341000,
                           tzinfo=tz.tzutc())
     }
     eventDict = syslog.syslogToUDPLogEvent(eventDict)
     self.assertEqual(1421337566.341, eventDict['timestamp'])