Skip to content

Instantly share code, notes, and snippets.

@uphy
Created March 9, 2017 12:39
Show Gist options
  • Save uphy/184e3613d2218dbae944db053ed8a63b to your computer and use it in GitHub Desktop.
Save uphy/184e3613d2218dbae944db053ed8a63b to your computer and use it in GitHub Desktop.
logstash - free command
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