Skip to content

Instantly share code, notes, and snippets.

@fefore
Created October 31, 2017 00:40
Show Gist options
  • Save fefore/25f731c047d10854a0f5d697c38de6f5 to your computer and use it in GitHub Desktop.
Save fefore/25f731c047d10854a0f5d697c38de6f5 to your computer and use it in GitHub Desktop.
[LOGSTASH] Grok pattern for AWS ELB Application Logs
filter {
if [type] == "elb-l7" {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:elb} %{IP:clientip}:%{INT:clientport:int} (?:(%{IP:backendip}:?:%{INT:backendport:int})|-) %{NUMBER:request_processing_time:float} %{NUMBER:backend_processing_time:float} %{NUMBER:response_processing_time:float} (?:-|%{INT:elb_status_code:int}) (?:-|%{INT:backend_status_code:int}) %{INT:received_bytes:int} %{INT:sent_bytes:int} \"%{ELB_REQUEST_LINE}\" \"(?:-|%{DATA:user_agent})\" (?:-|%{NOTSPACE:ssl_cipher}) (?:-|%{NOTSPACE:ssl_protocol})" ]
}
date {
match => [ "timestamp", "ISO8601" ]
}
mutate {
remove_field => [ "message", "timestamp" ]
}
geoip {
source => "clientip"
}
mutate {
update => {
"type" => "elb-l7-log"
}
}
}
}
@enVolt
Copy link

enVolt commented May 21, 2019

This works pretty well. Thanks

I've removed the part where original message field was removed (just personal thing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment