Input jdbc error handling

hi all

this is my input jdbc

input {
  jdbc {
    jdbc_driver_library => "/usr/share/java/postgresql.jar"
    jdbc_driver_class => "org.postgresql.Driver"
    jdbc_connection_string => "jdbc:postgresql://*.*.*.*/database"
    jdbc_user => "postgres"
    jdbc_password => "postgres"
    statement => "SELECT * FROM table limit 1"
    connection_retry_attempts => 5
    connection_retry_attempts_wait_time => 10
  }
}

output {
  kafka {
    bootstrap_servers => "*"
    topic_id => "topic001"
    codec => json_lines {}
  }
}

i want retry same statement when postgres sql failures.
i tried catch error handling on input jdbc but can not.

have any way?? and can i write statement sql on file??

i was try catch result use @timestamp on filter
here is my test filter code

filter {
  if [@timestamp] {
    mutate {
      add_field => { "destination" => "output1" }
    }
  } else {
    mutate {
      add_field => { "destination" => "output2" }
    }
  }
}

but when failures on input jdbc, filter was not work.

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