Time

Time Zone Normalizer

class TimeZoneNormalizer(app, pipeline, id=None, config=None)[source]

Bases: Processor

Description: Normalizes datetime from local timezone (e.g. in config) to UTC, which is preferred internal datetime form


TimeZoneNormalizer.__init__()[source]

Description:


Time Zone Normalizer Method

TimeZoneNormalizer.normalize(local_time: datetime) datetime[source]

Description: If local_time doesn’t contain a time zone (e.g. it is naive), the timezone will be added from config

Returns

Normalized local_time in UTC


TimeZoneNormalizer.process(context, event)[source]

Description: Abstract method to process the event. Must be customized.

Example:

>>> native_time = event["@timestamp"]
>>> local_time = self.normalize(native_time)
>>> event["@timestamp"] = local_time