Browse Source

Make datetime format in log files to be configurable

This patch adds possibility to configure in Tobiko what is the
format of the OpenStack services log lines format and how to
parse it to get date time from lines.

Change-Id: Ibe2c92e2a1dfbbd23f00cf1c635f9799a5c3e613
changes/00/804700/15
Slawek Kaplonski 11 months ago committed by Federico Ressi
parent
commit
74c5b7f818
  1. 6
      tobiko/openstack/topology/_neutron.py
  2. 4
      tobiko/openstack/topology/config.py

6
tobiko/openstack/topology/_neutron.py

@ -22,6 +22,7 @@ from oslo_log import log
import tobiko
from tobiko.openstack import neutron
from tobiko.openstack.topology import _config
from tobiko.openstack.topology import _topology
from tobiko.shell import files
@ -47,10 +48,13 @@ class NeutronNovaCommonReader(tobiko.SharedFixture):
log_digger: files.MultihostLogFileDigger
groups: typing.List[str]
message_pattern: str
datetime_pattern = re.compile(r'(\d{4}-\d{2}-\d{2} [0-9:.]+) .+')
datetime_pattern: typing.Pattern
config = tobiko.required_setup_fixture(_config.OpenStackTopologyConfig)
service_name = neutron.SERVER
def setup_fixture(self):
self.datetime_pattern = re.compile(
self.config.conf.log_datetime_pattern)
self.log_digger = self.useFixture(
_topology.get_log_file_digger(
service_name=self.service_name,

4
tobiko/openstack/topology/config.py

@ -35,6 +35,10 @@ OPTIONS = [
default=None,
choices=['', '4', '6'],
help="Limit connectivity to cloud to IPv4 o IPv6"),
cfg.StrOpt('log_datetime_pattern',
default=r"(\d{4}-\d{2}-\d{2} [0-9:.]+) .+",
help="Regex to be used to parse date and time from "
"the OpenStack services' log lines. "),
]

Loading…
Cancel
Save