RHN Logs - Files /var/log/rhn/*.log

Modules for parsing the content of log files under /rhn-logs/rhn directory in spacewalk-debug or sosreport archives of Satellite 5.x.

Note

Please refer to the super-class insights.core.LogFileOutput

class insights.parsers.rhn_logs.SatelliteServerLog(context)[source]

Bases: LogFileOutput

Class for parsing the var/log/rhn/rhn_server_satellite.log file

Sample log contents:

2016/11/19 01:13:35 -04:00 Downloading errata data complete
2016/11/19 01:13:35 -04:00 Downloading kickstartable trees metadata
2016/11/19 01:13:35 -04:00    Retrieving / parsing kickstart tree files: rhel-x86_64-server-optional-6-debuginfo (NONE RELEVANT)
2016/11/19 01:13:39 -04:00    debug/output level: 1
2016/11/19 01:13:39 -04:00    db:  rhnsat/<password>@rhnsat
2016/11/19 01:13:39 -04:00
2016/11/19 01:13:39 -04:00 Retrieving / parsing channel-families data
2016/11/19 01:13:44 -04:00 channel-families data complete
2016/11/19 01:13:44 -04:00
2016/11/19 01:13:44 -04:00 RHN Entitlement Certificate sync

Examples

>>> log = shared[SatelliteServerLog]
>>> log.get('Downloading')[0['raw_message']
'2016/11/19 01:13:35 -04:00 Downloading errata data complete', '2016/11/19 01:13:35 -04:00 Downloading kickstartable trees metadata'
>>> list(log.set_after(datetime(2016, 11, 19, 1, 13, 44)))[0]['raw_message']
'2016/11/19 01:13:44 -04:00 channel-families data complete', '2016/11/19 01:13:44 -04:00 ', '2016/11/19 01:13:44 -04:00 RHN Entitlement Certificate sync'
time_format = '%Y/%m/%d %H:%M:%S'

The timestamp format assumed for the log files. A subclass can override this for files that have a different timestamp format. This can be:

  • A string in strptime() format.

  • A list of strptime() strings.

  • A dictionary with each item’s value being a strptime() string. This allows the item keys to provide some form of documentation.

class insights.parsers.rhn_logs.SearchDaemonLog(context)[source]

Bases: LogFileOutput

Class for parsing the /var/log/rhn/search/rhn_search_daemon.log file.

Sample log contents:

STATUS | wrapper  | 2013/01/28 14:41:58 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2013/01/28 14:41:58 | Launching a JVM...
INFO   | jvm 1    | 2013/01/28 14:41:59 | Wrapper (Version 3.2.1) http://wrapper.tanukisoftware.org
STATUS | wrapper  | 2013/01/29 17:04:25 | TERM trapped.  Shutting down.
lines

All lines captured in this file.

Type

list

Examples

>>> log = shared[SearchDaemonLog]
>>> log.file_path
'var/log/rhn/search/rhn_search_daemon.log'
>>> log.get('Launching a JVM')[0]['raw_message']
'STATUS | wrapper  | 2013/01/28 14:41:58 | Launching a JVM...'
>>> list(log.get_after(datetime(2013, 1, 29, 0, 0, 0)))[0]['raw_message']
'STATUS | wrapper  | 2013/01/29 17:04:25 | TERM trapped.  Shutting down.'
time_format = '%Y/%m/%d %H:%M:%S'

The timestamp format assumed for the log files. A subclass can override this for files that have a different timestamp format. This can be:

  • A string in strptime() format.

  • A list of strptime() strings.

  • A dictionary with each item’s value being a strptime() string. This allows the item keys to provide some form of documentation.

class insights.parsers.rhn_logs.ServerXMLRPCLog(context)[source]

Bases: LogFileOutput

Class for parsing the rhn_server_xmlrpc.log file.

Sample log line:

2016/04/11 05:52:01 -04:00 23630 10.4.4.17: xmlrpc/registration.welcome_message('lang: None',)
lines

All lines captured in this file.

Type

list

last

Dict of the last log line.

Type

dict

Examples

>>> log = shared[ServerXMLRPCLog]
>>> log.file_path
'var/log/rhn/rhn_server_xmlrpc.log'
>>> log.get('two')
[{'timestamp':'2016/04/11 05:52:01 -04:00',
  'datetime': datetime(2016, 04, 11, 05, 52, 01),
  'pid': '23630',
  'client_ip': '10.4.4.17',
  'module': 'xmlrpc',
  'function': 'registration.welcome_message',
  'client_id': None,
  'args': "'lang: None'",
  'raw_message': "...two..."}]
>>> log.last
[{'timestamp':'2016/04/11 05:52:01 -04:00',
  'datetime': datetime(2016, 04, 11, 05, 52, 01),
  'pid': '23630',
  'client_ip': '10.4.4.17',
  'module': 'xmlrpc',
  'function': 'registration.welcome_message',
  'client_id': None,
  'args': "'lang: None'",
  'raw_message': "..."}]
parse_content(content)[source]

Parse the logs as its super class LogFileOutput. And get the last complete log. If the last line is not complete, then get from its previous line.

time_format = '%Y/%m/%d %H:%M:%S'

The timestamp format assumed for the log files. A subclass can override this for files that have a different timestamp format. This can be:

  • A string in strptime() format.

  • A list of strptime() strings.

  • A dictionary with each item’s value being a strptime() string. This allows the item keys to provide some form of documentation.

class insights.parsers.rhn_logs.TaskomaticDaemonLog(context)[source]

Bases: LogFileOutput

Class for parsing the rhn_taskomatic_daemon.log file.

Note

Because of the need to get the datetime of the last log, please DO NOT filter it.

lines

All lines captured in this file.

Type

list

last_log_date

The last log datetime get from the last line.

Type

datetime

Examples

>>> td_log = shared[TaskomaticDaemonLog]
>>> td_log.file_path
'var/log/rhn/rhn_taskomatic_daemon.log'
>>> td_log.get('two')[0]['raw_message']
'Log file line two'
>>> 'three' in td_log
True
>>> td_log.last_log_date
2016-05-18 15:13:40
parse_content(content)[source]

Once the logs are parsed, retrieve the last log date from the last line which has a complete timestamp in the third field.

time_format = '%Y/%m/%d %H:%M:%S'

The timestamp format assumed for the log files. A subclass can override this for files that have a different timestamp format. This can be:

  • A string in strptime() format.

  • A list of strptime() strings.

  • A dictionary with each item’s value being a strptime() string. This allows the item keys to provide some form of documentation.