Skip to content

Instantly share code, notes, and snippets.

@tanmay-bhat
Created May 29, 2022 05:31
Show Gist options
  • Save tanmay-bhat/a0706188245767ee562bbe795fd8b39b to your computer and use it in GitHub Desktop.
Save tanmay-bhat/a0706188245767ee562bbe795fd8b39b to your computer and use it in GitHub Desktop.
Apache & Nginx parser configs for fluent-bit
[PARSER]
Name apache
Format regex
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name nginx
Format regex
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment