Closed zgjhust closed 5 years ago
Check what datatype and how you're casting your datetime string. MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME). So if you're using cast(? as timestamp)
in your logstash-output-jdbc string you'll need to modify it to the equivalent that MySQL supports (presumably cast(? as datetime)
).
resolved by this:
statement => ["insert into t1 (record_time) values ( convert_tz(?, '+00:00', '+08:00'))","record_time"]
the log item looks like
but when inserted into mysql, it looks like
the time zone of mysql server is +08:00, it is supposed to be 2018-12-17 14:57:58
Environment