Hi all,
I am using https://openweathermap.org/ current weather API to display current weather data.
I was able successfully visualize the data on Kibana after it created a new index weather-2018.07.18.
Here is my logstash config file.
input {
http_poller {
urls => {
weather => {
url => "http://api.openweathermap.org/data/2.5/weather?id=5490223&appid=MY_APP_ID&units=metric"
headers => {
Accept => "application/json"
}
}
}
schedule => { cron => "* */2 * * * *" }
codec => json
}
}
filter {
mutate {
remove_field => ["@version" ,"command" ,"host" ,"cod" ,"id" ,"base" ,"coord" ,"sys" ,"dt"]
}
split { field => "weather" }
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "weather-%{+YYYY.MM.dd}"
}
stdout {
codec => rubydebug
}
}
However, after 24 hours a new index weather-2018.07.19 was created on elasticsearch.
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana ZB7x3FQyQlyRvkRIaEGi2g 1 0 5 0 32.7kb 32.7kb
green open .monitoring-kibana-6-2018.07.12 8iFI69JhQL-bLWsGZzFQYA 1 0 2370 0 697.8kb 697.8kb
green open .monitoring-es-6-2018.07.12 4-XcOMWsRkW7_enzqslTQg 1 0 34226 115 12.7mb 12.7mb
yellow open logstash-2018.07.13 _oiQOnpMQ4KQcHssK8PmxA 5 1 9999 0 7mb 7mb
green open .monitoring-es-6-2018.07.18 h_ylFE80RS6153Sx5A7o6A 1 0 51522 175 23.4mb 23.4mb
green open .monitoring-es-6-2018.07.15 27pTcx8TTDqchfQgo7WQ-w 1 0 234 0 160.2kb 160.2kb
green open .monitoring-kibana-6-2018.07.16 Lmydu8eOS8-p6aKPP7SUqw 1 0 1383 0 465.1kb 465.1kb
green open .monitoring-es-6-2018.07.17 HThfGRdATO-C455Xm_-e9Q 1 0 49107 175 18.1mb 18.1mb
green open .monitoring-kibana-6-2018.07.17 u1EedigZSWeXOaOwdueEdQ 1 0 2450 0 700.7kb 700.7kb
green open .monitoring-kibana-6-2018.07.14 17TgPEalTAOJRe3gb59eZA 1 0 15 0 87.5kb 87.5kb
green open .monitoring-es-6-2018.07.19 YbmtJ2qLSNSAJIEluEz3Zw 1 0 9304 235 9.9mb 9.9mb
green open .monitoring-es-6-2018.07.16 3iZspMNoQUuty5lYM5ylvg 1 0 39028 135 17.3mb 17.3mb
yellow open weather-2018.07.19 M7b9ojh3Qc631m8NqlZOzA 5 1 1364 0 348.7kb 348.7kb
green open .monitoring-kibana-6-2018.07.19 br9oBb0ISgi5x-ZkDb7Hnw 1 0 372 0 346.5kb 346.5kb
green open .monitoring-es-6-2018.07.13 1FBGvkSzR4yf7WcyrwN3LQ 1 0 51214 50 19.2mb 19.2mb
yellow open weather-2018.07.18 EAxPkKAPQceMEH9K2u_EEQ 5 1 4378 0 731.1kb 731.1kb
green open .monitoring-kibana-6-2018.07.18 ZnYApUXKQbiH9CVFRqmzdw 1 0 2463 0 742.6kb 742.6kb
green open .monitoring-kibana-6-2018.07.15 9TZ9csgUQp-LrAbRYT4aGw 1 0 9 0 127.5kb 127.5kb
green open .monitoring-kibana-6-2018.07.13 Cpt83ctnQiqLWiydy1nmUw 1 0 2585 0 830.1kb 830.1kb
green open .monitoring-es-6-2018.07.14 fuXHKIMNS5u15-XR0dvrTw 1 0 380 162 575.3kb 575.3kb
yellow open current_weather-2018.07.19 Xm-WY_9oTQOP1gXk9k3T9Q 5 1 1 0 460b 460b
I'm guessing this has something to do with the index configuration option. How do I make sure that there is only one index pattern for logstash that keeps pulling live weather. Also, how do I configure http_poller plugin to ensure it keeps pulling data every second? Would really appreciate if you could help me. Thanks in advance!