OSADispatcherLog - file /var/log/rhn/osa-dispatcher.log
¶
-
class
insights.parsers.osa_dispatcher_log.
OSADispatcherLog
(context)[source]¶ Bases:
insights.core.LogFileOutput
Reads the OSA dispatcher log. Based on the
LogFileOutput
class.Note
Please refer to its super-class
insights.core.LogFileOutput
Works a bit like the XMLRPC log but the IP address always seems to be
0.0.0.0
and the module is always ‘osad’ - it’s more like what produced the log.Sample log data:
2015/12/23 04:40:58 -04:00 28307 0.0.0.0: osad/jabber_lib.__init__ 2015/12/23 04:40:58 -04:00 28307 0.0.0.0: osad/jabber_lib.setup_connection('Connected to jabber server', u'example.com') 2015/12/23 04:40:58 -04:00 28307 0.0.0.0: osad/osa_dispatcher.fix_connection('Upstream notification server started on port', 1290) 2015/12/23 04:40:58 -04:00 28307 0.0.0.0: osad/jabber_lib.process_forever 2015/12/27 22:48:50 -04:00 28307 0.0.0.0: osad/jabber_lib.main('ERROR', 'Error caught:') 2015/12/27 22:48:50 -04:00 28307 0.0.0.0: osad/jabber_lib.main('ERROR', 'Traceback (most recent call last)')
Example
>>> osa = shared[OSADispatcherLog] >>> osa.get('__init__') [{'raw_message': '2015/12/23 04:40:58 -04:00 28307 0.0.0.0: osad/jabber_lib.__init__', 'timestamp': '2015/12/23 04:40:58 -04:00', 'datetime': datetime.datetime(2015, 12, 23, 4, 40, 58), 'pid': '28307', 'client_ip': '0.0.0.0', 'module': 'osad', 'function': 'jabber_lib.__init__', 'info': None} ] >>> osa.last() {'raw_message': "2015/12/27 22:48:50 -04:00 28307 0.0.0.0: osad/jabber_lib.main('ERROR', 'Traceback (most recent call last)')", 'timestamp': '2015/12/27 22:48:50 -04:00', 'datetime': datetime.datetime(2015, 12, 27, 22, 48, 50), 'pid': '28307', 'client_ip': '0.0.0.0', 'module': 'osad', 'function': 'jabber_lib.main', 'info': "'ERROR', 'Traceback (most recent call last)'"} >>> from datetime import datetime >>> len(list(osa.get_after(datetime(2015, 12, 27, 22, 48, 0)))) 2