OpenVSwitchLogs - files ovsdb-server.log and ovs_vswitchd.log

A standard log file reader for logs written by OpenVSwitch.

The logs have a standard format:

2016-03-08T02:10:01.155Z|01417|vlog|INFO|opened log file /var/log/openvswitch/ovs-vswitchd.log
2016-03-08T02:20:05.425Z|01418|connmgr|INFO|br0<->unix: 1 flow_mods in the last 0 s (1 adds)
2016-03-08T02:20:10.160Z|01419|connmgr|INFO|br0<->unix: 1 flow_mods in the last 0 s (1 deletes)
2016-03-08T11:30:52.206Z|00013|fatal_signal|WARN|terminating with signal 15 (Terminated)

The get method breaks up log lines on the bar character (‘|’) into the following fields:

  • timestamp - the UTC time stamp

  • sequence - the sequence number of this message

  • module - the module in OpenVSwitch that emitted this error

  • level - the level of error (INFO, WARN, ERROR)

  • message - the rest of the message.

Each line of the resultant list is a dictionary with those fields.


>>> vswlog = shared[OVSDB_Server_Log]
>>> 'fatal_signal' in vswlog
>>> vswlog.get('fatal_signal')
[{'timestamp': '2016-03-08T11:30:52.206Z', 'sequence': '00013',
  'module': 'fatal_signal', 'level': 'WARN',
  'message': 'terminating with signal 15 (Terminated)',
  'raw_message': '2016-03-08T11:30:52.206Z|00013|fatal_signal|WARN|terminating with signal 15 (Terminated)']
class insights.parsers.openvswitch_logs.OVSDB_Server_Log(context)[source]

Bases: OpenVSwitchLog

Parser for the ovsdb_server.log file, based on the OpenVSwitchLog class.

class insights.parsers.openvswitch_logs.OVS_VSwitchd_Log(context)[source]

Bases: OpenVSwitchLog

Parser for the ovs-vswitchd.log file, based on the OpenVSwitchLog class.

class insights.parsers.openvswitch_logs.OpenVSwitchLog(context)[source]

Bases: LogFileOutput

Template class for reading OpenVSwitch logs.


Please refer to its super-class insights.core.LogFileOutput for more usage information.

time_format = '%Y-%m-%dT%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.

  • A None value when there is no timestamp info in the log file