Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Can't parse timezone minute offsets #19

Description

@himanshu-pro

import apache_log_parser
line_parser = apache_log_parser.make_parser("%t")
data = line_parser("[16/Aug/2013:15:45:34 +0435]")
data
{'time_received': '[16/Aug/2013:15:45:34 +0435]', 'time_received_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34), 'time_received_isoformat': '2013-08-16T15:45:34', 'time_received_tz_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34, tzinfo='0435'), 'time_received_tz_isoformat': '2013-08-16T15:45:34+04:03', 'time_received_utc_datetimeobj': datetime.datetime(2013, 8, 16, 11, 42, 34, tzinfo='0000'), 'time_received_utc_isoformat': '2013-08-16T11:42:34+00:00'}

while expected is:

{'time_received': '[16/Aug/2013:15:45:34 +0435]', 'time_received_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34), 'time_received_isoformat': '2013-08-16T15:45:34', 'time_received_tz_datetimeobj': datetime.datetime(2013, 8, 16, 15, 45, 34, tzinfo='0435'), 'time_received_tz_isoformat': '2013-08-16T15:45:34+04:35', 'time_received_utc_datetimeobj': datetime.datetime(2013, 8, 16, 11, 10, 34, tzinfo='0000'), 'time_received_utc_isoformat': '2013-08-16T11:10:34+00:00'}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions