Created
March 9, 2017 12:39
-
-
Save uphy/184e3613d2218dbae944db053ed8a63b to your computer and use it in GitHub Desktop.
logstash - free command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
exec { | |
command => "free -b" | |
interval => 10 | |
} | |
} | |
filter { | |
grok { | |
match => { | |
"message" => ".*?Mem:\s*?%{NUMBER:total}\s*?%{NUMBER:used}\s*?%{NUMBER:free}\s*?%{NUMBER:shared}\s*?%{NUMBER:buffers}\s*?%{NUMBER:cached}\s*?\-/\+ buffers/cache:\s*?%{NUMBER:actual.used}\s*?%{NUMBER:actual.free}\s*?Swap:\s*?%{NUMBER:swap.total}\s*?%{NUMBER:swap.used}\s*?%{NUMBER:swap.free}.*" | |
} | |
remove_field => [ "message", "command" ] | |
} | |
mutate { | |
convert => { | |
"total" => "integer" | |
"used" => "integer" | |
"free" => "integer" | |
"shared" => "integer" | |
"buffers" => "integer" | |
"cached" => "integer" | |
"actual.used" => "integer" | |
"actual.free" => "integer" | |
"swap.total" => "integer" | |
"swap.used" => "integer" | |
"swap.free" => "integer" | |
} | |
} | |
} | |
output { | |
elasticsearch { | |
hosts => "elasticsearch:9200" | |
index => "free-%{+YYYY.MM.dd}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment