Unable to create index in elasticsearch


#1

Hi all,

I am following this link (Link) to display live weather data on Kibana.

I used the logstash configuration explained in the pdf.

Here is my logstash configuration:

input {
  exec {
    command => 'curl --silent -L "http://api.openweathermap.org/data/2.5/weather?id=5490223&appid=MY_API_KEY&units=metric"'
    codec => "json"
    interval => 600
  }
}
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
  }
}

After I start logstash, I checked the log file logstash-plain.log

[2018-07-18T11:18:18,301][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2018-07-18T11:18:18,764][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.3.1"}
[2018-07-18T11:18:22,501][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-07-18T11:18:22,879][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://localhost:9200/]}}
[2018-07-18T11:18:22,886][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://localhost:9200/, :path=>"/"}
[2018-07-18T11:18:23,089][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://localhost:9200/"}
[2018-07-18T11:18:23,168][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=>6}
[2018-07-18T11:18:23,177][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=>6}
[2018-07-18T11:18:23,213][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//localhost:9200"]}
[2018-07-18T11:18:23,252][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2018-07-18T11:18:23,297][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-*", "version"=>60001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_default_"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
[2018-07-18T11:18:23,369][INFO ][logstash.inputs.exec     ] Registering Exec Input {:type=>nil, :command=>"curl --silent -L \"http://api.openweathermap.org/data/2.5/weather?id=5490223&appid='My_API_Key'&units=metric\"", :interval=>600, :schedule=>nil}
[2018-07-18T11:18:23,409][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x7420a8b0 run>"}
[2018-07-18T11:18:23,552][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2018-07-18T11:18:24,086][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}

As per my understanding, it seems to be running fine, but, I don't see any index beginning with weather-*, created in elasticsearch.

health status index                           uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .kibana                         ZB7x3FQyQlyRvkRIaEGi2g   1   0          2            0     12.3kb         12.3kb
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      11538            0       11mb           11mb
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.16     3iZspMNoQUuty5lYM5ylvg   1   0      39028          135     17.3mb         17.3mb
green  open   .monitoring-es-6-2018.07.13     1FBGvkSzR4yf7WcyrwN3LQ   1   0      51214           50     19.2mb         19.2mb
green  open   .monitoring-kibana-6-2018.07.18 ZnYApUXKQbiH9CVFRqmzdw   1   0        530            0    413.1kb        413.1kb
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

What wrong am I doing? Have I missed out on any steps that I should have followed?


(Mark Walkom) #2

I would suggest you look at using the http_poller input rather than the exec one.


#3

Thanks a lot! I will take a look at it.


(Rijin) #4

Is it solved ? Can you show your logstash.yml file ?


(system) #5

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