apache-log-parser icon indicating copy to clipboard operation
apache-log-parser copied to clipboard

Datatime pattern does'nt work

Open erwanbodere opened this issue 8 years ago • 0 comments

Hi,

I have this apache pattern for date : %{%FT%T%z}t Sample log date : 2017-09-20T00:06:16+0200

**Code **

_format = "%{%FT%T%z}t" line_parser = apache_log_parser.make_parser(_format) log_line_data = line_parser('2017-09-20T00:06:16+0200') pprint(log_line_data)

**Error **

Traceback (most recent call last): line_parser = apache_log_parser.make_parser(format) File "...\site-packages\apache_log_parser_init.py", line 236, in make_parser return Parser(format_string).parse File "...\site-packages\apache_log_parser_init_.py", line 219, in init self.log_line_regex = re.compile(self.log_line_regex) File "...\conda\anaconda2\lib\re.py", line 194, in compile return _compile(pattern, flags) File "...\conda\anaconda2\lib\re.py", line 251, in compile raise error, v # invalid expression sre_constants.error: bad character in group name 'time%ft%t%z'

Doumentation

The time, in the form given by format, which should be in strftime(3) format. (potentially localized)

Have you any idea ?

Regards

erwanbodere avatar Dec 14 '17 09:12 erwanbodere