Configure Logstash to import json from REST and visualise a Time/Value-Chart in Kibana

Hi,

i'm trying to import a json-structure from a RESt-API into Elasticsearch. Then i want to create a line-chart from a time/value-pair.

In detail:

Json:

{
    "self":{
"href":"https://anUrl"
},
"version":2,
"values":[{
	"unit":"kWh",
	"time":"2018-11-26T23:15:00Z",
	"displayEnd":6.923634E7,
	"value":0.16,
	"displayStart":6.923617E7
},{
	"unit":"kWh",
	"time":"2018-11-26T23:30:00Z",
	"displayEnd":6.923651E7,
	"value":0.17,
	"displayStart":6.923634E7
} ...

Logstash-Config:

input { 
http_poller {
	urls => {
	  test => {
			method => get
			user => "xxx"
			password => "xxx"
			url => "http://anUrl"
			headers => {
			  Accept => "application/json"
			}
		}
	}
	
	request_timeout => 60
	schedule => { cron => "* * * * * UTC"}
	codec => "json"
	metadata_target => "http_poller_metadata"
    }
}

filter {
split {
	field => "values"
}

mutate {
	add_field => { 
                    # this is a test
		"value" => "%{[values][value]"
	}
	
}
}

output {
 elasticsearch {		
	hosts => ["127.0.0.1:9200"]
	index => "efficio"
 }

     stdout {
        codec => rubydebug
     }
}

The Values are in the "values"-array.
In Kibana i want to create a line chart that displays on the x-axis the timestamps from json ("time") and on the y-axis the value of the timestamp ("value")

Thanks for your help!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.