I have a log file with a lot of lines. Example:
219.133.7.154 - price5585 [21/Jun/2019:15:45:53 -0700] "GET /incubate/incubate HTTP/1.1" 201 12126
I need as the output something like this:
{host: 219.133.7.154, user: price5585, date: 21/Jun/2019:15:45:53 -0700, req: GET /incubate/incubate HTTP/1.1}
I really struggle with that and got only 2 first things working. Here is my code:
pattern = """
(?P<host>.*) #Host name
(-\ )
(?P<username>\w*) #username
(?P<time>\w*) #Time
"""
How should pattern look, so I can extract everything I need?