Skip to content

Instantly share code, notes, and snippets.

@slashr
Created June 16, 2016 06:47
Show Gist options
  • Save slashr/78537f8f2bd28e324ce538c3abf9ee8c to your computer and use it in GitHub Desktop.
Save slashr/78537f8f2bd28e324ce538c3abf9ee8c to your computer and use it in GitHub Desktop.
Logstash Configuration File to Analyze ELB Logs
input {
s3 {
bucket => "elb-logs-bucket-name"
region => "us-east-1"
codec => "line"
interval => 30
}
}
filter {
mutate { replace => { "type" => "elb" } }
grok {
match => {
"message" => [
"%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:loadbalancer} %{IP:client_ip}:%{NUMBER:client_port:int} %{IP:backend_ip}:%{NUMBER:backend_port:int} %{NUMBER:elb_request_time:float} %{NUMBER:backend_response_time:float} %{NUMBER:elb_response_time:float} %{NUMBER:elb_status_code:int} %{NUMBER:backend_status_code:int} %{NUMBER:received_bytes:int} %{NUMBER:sent_bytes:int} %{QS:request} %{QS:user_agent} %{NOTSPACE:cipher} %{NOTSPACE:protocol}" ,
"%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:loadbalancer} %{DATA:message}"
]
}
}
date {
match => [ timestamp, "ISO8601" ]
}
}
output {
elasticsearch {
hosts => ["elastisearch-endpoint"]
index => "elb_logs"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment