I started to play with python3.8 re lib and I find strange things. First I'm making my regex online to test how it works and when I found out that its already working I try in python.
test_string = [Tues Jan 20 11:35:13.405644 2020] [access_compat:error] [pid 1871:tid 140301098780416] [client 192.168.123.9:59662] AH01797: client denied by server configuration: /var/www/website/401.html
res = re.compile(r"(?P<Time>\w+\s\w+\s\d+\s\d+:\d+:\d{2})|(?P<Type>[a-zA-Z]+_\w+:\w+)", re.VERBOSE)
for line in logfile:
line = res.search(line)
print(line.groupdict())
I'm trying to parse log line like that like that. but I get the following result:
type : none
I dont know why, or how to fix it , any ideas?:
{'time': Mon Jan 20 11:34:13, 'type': access_compat:error}