Skip to content

Instantly share code, notes, and snippets.

@meetme2meat
Created May 2, 2016 09:02
Show Gist options
  • Save meetme2meat/f615a0da7a8dfad4d241da651b74d8fc to your computer and use it in GitHub Desktop.
Save meetme2meat/f615a0da7a8dfad4d241da651b74d8fc to your computer and use it in GitHub Desktop.
input {
udp {
port => 5300
codec => 'json'
}
}
## the policy_router SQL filter
filter {
if ([type] == "policy_router") {
grok {
patterns_dir => ["/etc/logstash/pattern"]
match => { "message" => "%{ARSQL:sql}" }
add_field => {"grok" => "true"}
}
if ([grok] == 'true') {
mutate {
replace => {"type" => "pr-sql"}
remove_field => ["grok"]
}
}
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
sniffing => true
manage_template => false
index => "%{[type]}-%{+YYYY.MM.dd}"
document_type => "%{[type]}"
}
}
@meetme2meat
Copy link
Author

meetme2meat commented May 2, 2016

## SQL regex for policy router.
ARSQL ((.+?) \(\d+\.\d+ms\)  (BEGIN|SELECT|INSERT|UPDATE|DELETE|COMMIT|ROLLBACK) .+)

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