Using Logstash to transfer data from mysql to elasticsearch about TIME

Using elasticsearch 6.3.1
logstash 6.3.1

I m using logstash to transfer data from mysql to elasticsearch But i realized that the time field is confused.There is a field named 'gmt_create' , it s '2018-07-13 16:50:04' in mysql and it's '2018-07-13T21:50:04.000Z'.It is 5 hour faster than mysql's. and mysql's time-zone is

system_time_zone CST
time_zone SYSTEM

and the logstash's timestamp is 8 hour lesser than the moment.
statement => "select * from wxhc_agent_exhibition_park_info where gmt_modify >= :sql_last_value"
schedule => "* * * * *"
record_last_run => true

      use_column_value => false

      tracking_column => "gmt_modify"
    
      tracking_column_type => "timestamp"

      last_run_metadata_path => "./logstash_capital_bill_last_id"

      clean_run => false

      lowercase_column_names => false
      jdbc_default_timezone =>"Asia/Shanghai"

and the server's timezone is (date -R)
Mon, 24 Dec 2018 17:52:31 +0800
all the answers is talking about cst to utc ,8hours . But how 's the 5-hours coming from ?
plz help me this really confusing me .

Hello,
Please give mapping to all fields before inserting data from mysql to elasticssearch like,

PUT indexname/
{
"mappings":{
"_doc":{
"properties":{
"id":{
"type":"long"
},
"gmt_create":{
"type":"date",
"format":"yyyy-MM-dd HH:mm:ss"
}
}
}
}
}

Hope this helps you to get correct date

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