Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Experiments with Time::Moment and normalizing logfiles to UTC (#11) #13
This change tries to implement issue #11 in a couple of ways.
First, it introduces NormalizeToUTC parser variable which makes it try to output iso 8601 compliant datetimes. It has two modes of operation - slow one using DateTime for DST calculation when your syslog doesn't have iso 8601 datetimes (i.e. the timezone offset is missing), and an ultra fast one using only Time::Moment - when your syslog is compliant.
Sadly, the slow normalize mode is slower than the previous iteration (see benchmarks), this is mainly to heavy magic going on in DateTime to calculate correct DST values needed to calculate UTC offset.
Second, this patch introduces functions for "setting syslog timezone", making the parser treat all datetimes without explicit timezones in the timestamp as belonging to the set zone. It allows you to set zones other than local and normalize them if for example you have files from different TZs.
If you don't need normalizing, and only care about literal date values, you can use IgnoreTimeZones mode - which is notably faster than the default (~300%).
You can also turn off date parsing altogether.
Last but not least tests also received a bit of love.