Skip to content

Parse IIS access log #20235

Answered by vividDuck
atomotic asked this question in Q&A
Discussion options

You must be logged in to vote

This is the remap I've used and works for an iis log format of:

#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken X-Forwarded-For

Basically they are space separated, so you could use the parse_csv, parse_csv!(.message, delimiter: " "). But that would not provide a header.

remap_iis_logs:
    inputs:
      - g_iis_logs
    type: remap
    source: |
            . |= parse_regex!(.message, r'(?P<datetime>[^ ]+ [^ ]+) (?P<source_ip>[^ ]+) (?P<method>[^ ]+) (?P<uri_stem>[^ ]+) (?P<uri_query>[^ ]+) (?P<source_port>[^ ]+) (?P<username>[^ ]+) (?P<client_ip>[^ ]+) (?P<ve…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pront
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
domain: vrl Anything related to the Vector Remap Language
3 participants