# Input jdbc error handling

**URL:** <https://discuss.elastic.co/t/input-jdbc-error-handling/342836>\
**Category:** Logstash\
**Created:** [September 12, 2023, 1:03pm UTC](https://discuss.elastic.co/t/input-jdbc-error-handling/342836 "2023-09-12T13:03:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![inbeom\_cho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inbeom_cho/32/123115_2.png) [@inbeom\_cho](https://discuss.elastic.co/u/inbeom_cho)\
**Post date:** [September 12, 2023, 1:03pm UTC](https://discuss.elastic.co/t/input-jdbc-error-handling/342836/1 "2023-09-12T13:03:16Z")

</div>

hi all

this is my input jdbc

```auto
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

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

```

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

---

<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:** [October 10, 2023, 1:04pm UTC](https://discuss.elastic.co/t/input-jdbc-error-handling/342836/2 "2023-10-10T13:04:02Z")

</div>

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