I was new to ELKB stack.
I use http beat to get the metrics data from my spring boot app, and send it to logstash for solving.
But I can not find any helpful info to solve my json data to the data I want for sending to elastic search.
Here is my metric data(after solved by logstash ):
{
"@timestamp" => 2018-12-28T02:23:01.003Z,
"beat" => {
"hostname" => "hostname",
"name" => "name",
"version" => "4.0.0"
},
"response" => {
"headers" => {
"Date" => "Fri, 28 Dec 2018 02:23:01 GMT",
"Pragma" => "no-cache",
"X-Frame-Options" => "DENY",
"X-Xss-Protection" => "1; mode=block",
"X-Content-Type-Options" => "nosniff",
"Expires" => "0",
"Cache-Control" => "no-cache, no-store, max-age=0, must-re
alidate",
"Content-Disposition" => "inline;filename=f.txt",
"Content-Type" => "application/json;charset=UTF-8"
},
"statusCode" => 200,
"jsonBody" => {
"measurements" => [
[0] {
"statistic" => "VALUE",
"value" => 32
}
],
"name" => "jvm.threads.live",
"availableTags" => [ ]
}
},
"type" => "httpbeat",
"@version" => "1",
"host" => "hostname",
"request" => {
"headers" => {
"Accept" => "application/json"
},
"method" => "get",
"url" => "http://localhost:8080/actuator/metrics/jvm.threads.live"
},
"fields" => {
"appid" => "appid"
},
"tags" => [
[0] "beats_input_raw_event"
]
}
and my logstash config do nothig, the config is
input {
beats {
port => "5044"
}
}
filter {
json {
source => "jsonBody"
remove_field => [ "headers" ] #seems not work for remove the field
}
}
output {
stdout { codec => rubydebug }
}
and the data I want is,
"jsonBody" => {
"measurements" => [
[0] {
"statistic" => "VALUE",
"value" => 32
}
],
"name" => "jvm.threads.live",
"availableTags" => []
}
and also the timestamp.
So can any one help. Any tutorial or logstash config is fine.
Thanks.