Thanks for your reply. I've got a valid json file now.
I followed your steps but I do not see any index pattern added in Elasticsearch.
Output of Logstash
[2018-03-14T15:34:10,365][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/usr/share/logstash/modules/fb_apache/configuration"}
[2018-03-14T15:34:10,371][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"/usr/share/logstash/modules/netflow/configuration"}
[2018-03-14T15:34:10,680][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"6.2.2"}
[2018-03-14T15:34:10,813][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2018-03-14T15:34:11,284][INFO ][logstash.pipeline ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-03-14T15:34:11,490][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://localhost:9200/]}}
[2018-03-14T15:34:11,492][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://localhost:9200/, :path=>"/"}
[2018-03-14T15:34:11,564][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://localhost:9200/"}
[2018-03-14T15:34:11,602][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=>nil}
[2018-03-14T15:34:11,602][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-03-14T15:34:11,605][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2018-03-14T15:34:11,608][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-03-14T15:34:11,617][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//localhost"]}
[2018-03-14T15:34:11,765][INFO ][logstash.pipeline ] Pipeline started succesfully {:pipeline_id=>"main", :thread=>"#<Thread:0x58af2551@/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:246 sleep>"}
[2018-03-14T15:34:11,782][INFO ][logstash.agent ] Pipelines running {:count=>1, :pipelines=>["main"]}
[2018-03-14T15:36:51,677][WARN ][logstash.runner ] SIGINT received. Shutting down.
[2018-03-14T15:36:51,920][FATAL][logstash.runner ] SIGINT received. Terminating immediately..
[2018-03-14T15:36:52,087][FATAL][logstash.runner ] SIGINT received. Terminating immediately..
[2018-03-14T15:36:52,126][ERROR][org.logstash.Logstash ] org.jruby.exceptions.ThreadKill
Config file:
➜ bin cat /etc/logstash/conf.d/test.conf
input {
file {
codec => json
path => "/tmp/sleep.json"
# additional file input configuration ...
}
}
filter {
date {
match => ["dateOfSleep", "yyyy-dd-MM"]
}
# any filters you want
}
output {
elasticsearch {
hosts => ["localhost"]
index => "sleep-quality"
# additional elasticsearch output configuration
}
}
The json file, so it is present at provided location:
➜ bin cat /tmp/sleep.json
[{
"dateOfSleep": "2018-03-01",
....
Full log with --debug option:
https://pastebin.com/5njEgsnS