Last active
May 23, 2018 11:09
-
-
Save fefore/d10b6ca96e5ef89c24b4b28253ceaac1 to your computer and use it in GitHub Desktop.
[LOGSTASH] Grok pattern for AWS Cloudfront logs
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
filter { | |
if [cloudfront_version] { | |
mutate { | |
gsub => ["message", "\t", " "] | |
} | |
dissect { | |
mapping => {"message" => "%{date} %{time} %{x_edge_location} %{sc_bytes} %{clientip} %{cs_method} %{cs_host} %{cs_uri_stem} %{sc_status} %{referrer} %{agent} %{cs_uri_query} %{cookies} %{x_edge_result_type} %{x_edge_request_id} %{x_host_header} %{cs_protocol} %{cs_bytes} %{time_taken} %{x_forwarded_for} %{ssl_protocol} %{ssl_cipher} %{x_edge_response_result_type} %{cs_protocol_version}"} | |
convert_datatype => { | |
sc_bytes => "int" | |
sc_status => "int" | |
cs_bytes => "int" | |
time_taken => "float" | |
} | |
add_field => {"timestamp" => "%{date} %{time}"} | |
} | |
date { | |
match => ["timestamp", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss"] | |
timezone => "UTC" | |
} | |
geoip { | |
source => "clientip" | |
} | |
mutate { | |
replace => { | |
"type" => "cloudfront" | |
} | |
remove_field => ["timestamp","message","cloudfront_fields"] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment