# Using Logstash to transfer data from mysql to elasticsearch about TIME

**URL:** <https://discuss.elastic.co/t/using-logstash-to-transfer-data-from-mysql-to-elasticsearch-about-time/161995>\
**Category:** Logstash\
**Created:** [December 24, 2018, 10:19am UTC](https://discuss.elastic.co/t/using-logstash-to-transfer-data-from-mysql-to-elasticsearch-about-time/161995 "2018-12-24T10:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lip](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@lip](https://discuss.elastic.co/u/lip)\
**Post date:** [December 24, 2018, 10:19am UTC](https://discuss.elastic.co/t/using-logstash-to-transfer-data-from-mysql-to-elasticsearch-about-time/161995/1 "2018-12-24T10:19:07Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)\
**Post date:** [December 24, 2018, 11:59am UTC](https://discuss.elastic.co/t/using-logstash-to-transfer-data-from-mysql-to-elasticsearch-about-time/161995/2 "2018-12-24T11:59:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 21, 2019, 11:59am UTC](https://discuss.elastic.co/t/using-logstash-to-transfer-data-from-mysql-to-elasticsearch-about-time/161995/3 "2019-01-21T11:59:49Z")

</div>

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