# Logstash input-jdbc work logic and last run sql\_last\_value

**URL:** https://discuss.elastic.co/t/logstash-input-jdbc-work-logic-and-last-run-sql-last-value/152649
**Category:** Logstash
**Created:** [October 16, 2018, 12:07pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-work-logic-and-last-run-sql-last-value/152649 "2018-10-16T12:07:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vara0855](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@vara0855](https://discuss.elastic.co/u/vara0855)
#### Post date: [October 16, 2018, 12:07pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-work-logic-and-last-run-sql-last-value/152649/1 "2018-10-16T12:07:23Z")

</div>

Hello  
I have ELK **6.3.2v.**  
Logstash-input-jdbc : **v4.3.9**

In my current configuration for the JDBC pipeline there are about 15-20 inputs with JDBC queries. Such inputs scheduled for run _every minute_ -\> "\* \* \* \* \*" or every day.  
For outputs I use elasticsearch-output.

I have a few questions about input works:

1. Why is the data in the file with the path **last\_run\_metadata\_path** written only after the JDBC request is full completed?

2. What happens if the executing JDBC query fails with an error on some moment? Data in the **last\_run\_metadata\_path** will be recorded?

3. Why the data in the file **last\_run\_metadata\_path** is not recorded for each page of the read request if I set the **jdbc\_paging** enabled.

4. What happens if the input does not have time to read all the data until the next scheduling execution ?

p.s. I experimented with jdbc\_fetch\_size, jdbc\_page\_size but they are not in the config example below  
Example of one of the inputs :

> ```
> input {
> jdbc {
> id => "input_jdbc_order"
> jdbc_driver_library => "${LOGSTASH_JDBC_DRIVER:ojdbc6.jar}"
> jdbc_driver_class => "Java::oracle.jdbc.OracleDriver"
> jdbc_connection_string => "${LOGSTASH_JDBC_CONNECTION}"
> jdbc_user => "${LOGSTASH_JDBC_USER}"
> jdbc_password => "${LOGSTASH_JDBC_PASSWORD}"
> use_column_value => true
> tracking_column => tracking_number
> last_run_metadata_path => "${LOGSTASH_METADATA_PATH}/main/order"
> statement_filepath => "${LOGSTASH_JDBC_SQL_SCRIPTS_PATH}/main/order.sql"
> schedule => "* * * * *" #run every minute
> add_field => {
> "[@metadata][type]" => "order"
> }
> }
> }
> 
> ```

Regards

---

<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: [November 13, 2018, 12:07pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-work-logic-and-last-run-sql-last-value/152649/2 "2018-11-13T12:07:24Z")

</div>

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