Instantly share code, notes, and snippets.

Embed
What would you like to do?
input {
file {
type => "gatling"
path => "/path/to/output.log"
start_position => "beginning"
}
}
filter {
if ([message] =~ "\bRUN\b" or [message] =~ "\bSTART\b" or [message] =~ "\bEND\b" or [message] =~ "\bGROUP\b") {
drop { }
}
if [type] == "gatling" {
grok {
match => { "message" => "%{DATA:scenario_name}\t%{NOTSPACE:user_id}\tREQUEST\t%{DATA:group}\t%{DATA:name}\t%{INT:requestStart:int}\t%{INT:requestEnd:int}\t%{INT:responseStart:int}\t%{INT:responseEnd:int}\t%{WORD:status}" }
keep_empty_captures => true
}
mutate {
gsub => [
"status", "OK", true,
"status", "KO", false
]
remove_field => ["host", "path", "type"]
}
mutate {
convert => { "status" => "boolean" }
}
date {
match => [ "requestStart", "UNIX_MS" ]
}
ruby {
code => "event['responseDuration'] = (event['responseEnd'] - event['requestStart'])"
}
}
}
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["localhost:9200"]
index => "gatling-%{+YYYY.MM.dd}"
codec => "json"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment