Hi there,
I'm trying to set up an ELK system to have a better overview over some data.
I have to flash code scanne which fill up a PostgreSQL database (Date - Hour - ID ect)
So i installed ELK follywing a random tuto btu i'm stuck on sending data to ES by logstash :
firstly i created an index in elastic search :
curl -X PUT http://localhost:9200/production -d '{"index.mapper.dynamic" : true}'
curl -X PUT http://localhost:9200/production/_mapping/prod -d '
{
** "prod":{**
** "properties": {**
** "idtraca_datas":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** },**
** "date_code":{**
** "index" : "analyzed",**
** "type" : "date"**
** },**
** "heure_data":{**
** "index" : "analyzed",**
** "type" : "date"**
** },**
** "code_produit":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** },**
** "num_lot":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** },**
** "code_lu":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** },**
** "id_code":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** },**
** "ligne":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** },**
** "orientation":{**
** "index" : "not_analyzed",**
** "type" : "string"**
** }**
** }**
** }**
}'
Then, with this logstash conf :
# file: ES_logstash.conf
input {
** jdbc {**
** jdbc_connection_string => "jdbc:postgresql://localhost:5432/production"**
** jdbc_user => "test"**
** jdbc_password => ""
** jdbc_validate_connection => true**
** jdbc_driver_library => "/home/test/Documents/postgresql-9.4.1208.jre7.jar"**
** jdbc_driver_class => "org.postgresql.Driver"**
** statement => 'SELECT * from "Traca_Datas" limit 1'**
** }**
}
output {
** elasticsearch {**
** hosts => "localhost:9200"**
** document_id => "%{uid}"**
** index => "production"**
** document_type => "prod"**
** }**
}
I got this error message :
{:timestamp=>"2016-03-22T09:16:13.539000+0100", :message=>"Failed action. ", :status=>400, :action=>["index", {:_id=>"%{uid}", :_index=>"production", :_type=>"prod", :_routing=>nil}, #<LogStash::Event:0x65783cd8 @metadata_accessors=#<LogStash::Util::Accessors:0x3653c1ed @store={}, @lut={}>, @cancelled=false, @data={"idtraca_datas"=>15, "date_code"=>#<Date: 2013-07-29 ((2456503j,0s,0n),+0s,2299161j)>, "heure_data"=>"2016-03-22T17:22:23.020Z", "id_code"=>"Code 128", "code_lu"=>"00082", "ligne"=>"L1", "orientation"=>169, "code_produit"=>"74123", "num_lot"=>"74123", "@version"=>"1", "@timestamp"=>"2016-03-22T08:16:10.687Z"}, @metadata={}, @accessors=#<LogStash::Util::Accessors:0x172c38ef @store={"idtraca_datas"=>15, "date_code"=>#<Date: 2013-07-29 ((2456503j,0s,0n),+0s,2299161j)>, "heure_data"=>"2016-03-22T17:22:23.020Z", "id_code"=>"Code 128", "code_lu"=>"00082", "ligne"=>"L1", "orientation"=>169, "code_produit"=>"74123", "num_lot"=>"74123", "@version"=>"1", "@timestamp"=>"2016-03-22T08:16:10.687Z"}, @lut={"uid"=>[{"idtraca_datas"=>15, "date_code"=>#<Date: 2013-07-29 ((2456503j,0s,0n),+0s,2299161j)>, "heure_data"=>"2016-03-22T17:22:23.020Z", "id_code"=>"Code 128", "code_lu"=>"00082", "ligne"=>"L1", "orientation"=>169, "code_produit"=>"74123", "num_lot"=>"74123", "@version"=>"1", "@timestamp"=>"2016-03-22T08:16:10.687Z"}, "uid"]}>>], :response=>{"index"=>{"_index"=>"production", "_type"=>"prod", "_id"=>"%{uid}", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [date_code]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2013-07-29 00:00:00 +0200" is malformed at " 00:00:00 +0200""}}}}, :level=>:warn}
I have an invalid format on the date, but how can i resolve it ? and if you guys found other mistake thanks for telling me.
Thanks for readin and for your help.
Josselin