Problem with logstash jdbc input plugin. Date field data is incorrect



I am using ELK GA 6.3.0. I have the logstash configuration like below;

input {
  jdbc {
    jdbc_driver_library => "ojdbc6.jar"
    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
    jdbc_connection_string => "jdbc:oracle:thin:@"
    jdbc_user => "user"
    jdbc_password => "pa$$word"
    statement => "SELECT START_TIME as timefield1, to_char(START_TIME, 'YYYY-MM-DD HH24:MI:SS:FF3') as timefield2 FROM mytable WHERE rownum <= 1"

output {
  stdout {
    codec => rubydebug {
      metadata => true

I am getting the output as;

  "timefield1" => 2018 - 10 - 22T00: 55: 39.587Z,
  "@version" => "1",
  "timefield2" => "2018-10-22 06:25:39:587",
  "@timestamp" => 2018 - 11 - 21T09: 42: 23.204Z,

Everything except hour and minute are same. Why is there a difference in hour and minute, and how to fix this?


(Faulander) #2

... and the select gives you the correct values when directly run in the db?
I don't think this is a logstash issue but a SQL "problem".


When i run the query in SQL console or SQL developer, the results are coming correct. That's why i wonder.

(Faulander) #4

this is strange. It cannot be a timezone issue, because then only the hours should be different.
I am out, i am not experienced with the jdbc plugin.


Hello @elasticheart,

can you show me the sample date format, present in your database.


(system) closed #6

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