Last active
June 10, 2022 15:48
-
-
Save garlandkr/4954272 to your computer and use it in GitHub Desktop.
JSON from varnishncsa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishncsa -F '{ | |
"@source" => "unknown", | |
"@type" => "varnish", | |
"@fields" => { | |
"remote_addr"=>"%h", | |
"remote_user" => "%u", | |
"x_forwarded_for" => "%{X-Forwarded-For}i", | |
"hit_miss"=>" %{Varnish:hitmiss}x", | |
"body_bytes_sent"=>"%b", | |
"request_time"=>"%{Varnish:time_firstbyte}x", | |
"status"=>"%s", | |
"request"=>"%r", | |
"host"=>"%{host}i", | |
"request_method"=>"%m", | |
"time_first_byte" => "%{Varnish:time_firstbyte}x", | |
"handling" => "%{Varnish:handling}x", | |
"http_referrer"=>"%{Referrer}i", | |
"http_user_agent"=>"%{User-agent}i", | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to do it logstash style, you can do:
I've also renamed some of the fields
To better match the Apache JSON Log Format here: