openstack-ansible-ops/elk_metrics_6x/templates/10-mysql.conf
Kevin Carter 5537e8b378
Add GeoIP capabilities into logstash
The geoip capabilities are built into logstash and can help a deployer
better understand the workloads they're running within their
environments. This change adds geoip capabilities in line with the
recommended practice from elastic.

Link: https://www.elastic.co/blog/geoip-in-the-elastic-stack

Change-Id: I109879bd9aeeaa0312eb3303e2e7566181ecff91
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-06-15 09:27:08 -05:00

38 lines
970 B
Plaintext

filter {
if "mysql" in [tags] {
grok {
match => { "message" => "# User@Host: %{WORD:user}\[%{WORD}\] @ (%{HOSTNAME:client_hostname}|) \[(%{IP:client_ip}|)\]" }
}
grok {
match => { "message" => "# Thread_id: %{NUMBER:thread_id:int} \s*Schema: (%{WORD:schema}| ) \s*QC_hit: %{WORD:qc_hit}" }
}
grok {
match => { "message" => "# Query_time: %{NUMBER:query_time:float} \s*Lock_time: %{NUMBER:lock_time:float} \s*Rows_sent: %{NUMBER:rows_sent:int} \s*Rows_examined: %{NUMBER:rows_examined:int}" }
}
grok {
match => { "message" => "(?m)SET timestamp=%{NUMBER:timestamp};%{GREEDYDATA:logmessage}" }
}
geoip {
source => "clientip"
}
date {
match => [ "timestamp", "UNIX" ]
}
mutate {
remove_field => "timestamp"
}
mutate {
gsub => [ "logmessage", "^\n", "" ]
add_field => { "module" => "mysql" }
add_field => { "loglevel" => "WARNING" }
}
}
}