Hour(-5:30 minutes) in all date are getting changed

Hi I am trying to migrate data from mysql to ELastic Search. But in es time is getting changed.
in mysql (2017-07-20 16:42:07) to (2017-07-20T11:12:07.000Z) in es .
following is my logstash.conf

input {
jdbc {
-- jdbc connection details --
jdbc_driver_class => "com.mysql.jdbc.Driver"
statement => "SELECT * FROM table"
jdbc_paging_enabled => true
jdbc_page_size => 5000
jdbc_default_timezone => "Asia/Kolkata"
}
}
filter {
date {
locale => "en"
timezone => "Asia/Kolkata"
match => ["created_at","yyyy-MM-dd'T'HH:mm:ssZ","ISO8601"]
target => "created_at"
}
}
output {
stdout { codec => json_lines }
elasticsearch {
"hosts" => ["aa.bb.cc.dd:9200"]
"index" => "xyzz"
"document_type" => "_doc"
"document_id" => "%{id}"
}
}

PS there are multiple date filed in same table. How to specify time zone at table level instead of per field.

All time stamps in Elasticsearch are stored in UTC timezone so it is that conversion you are seeing.

Yes, is there any way to have filed as date type and save it as it is. without zone difference.?

Timestamps must be in UTC in Elasticsearch as Kibana and some APIs assume this. You can however specify timezone when querying and have Elasticsearch translate/convert it for you.

I guess We can specify timezone only when querying in range. I wanted correct date even when querying other field.

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