# Is there any way to update the \`last\_run\_metadata\_file\` in the output plugin?

**URL:** https://discuss.elastic.co/t/is-there-any-way-to-update-the-last-run-metadata-file-in-the-output-plugin/348919
**Category:** Logstash
**Created:** [December 8, 2023, 3:34pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-update-the-last-run-metadata-file-in-the-output-plugin/348919 "2023-12-08T15:34:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![gayatri\_SN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gayatri_sn/32/105321_2.png) [@gayatri\_SN](https://discuss.elastic.co/u/gayatri_SN)
#### Post date: [December 8, 2023, 3:34pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-update-the-last-run-metadata-file-in-the-output-plugin/348919/1 "2023-12-08T15:34:32Z")

</div>

My scenario is as follows: I am using the JDBC input plugin with a tracking column and `last_run_metadata_file`, and it is working as expected. However, when the ETL host is down or unreachable, the filter API throws an error. Now, I want to update the `last_run_metadata_file` after indexing, not after SQL query execution. Is there any way to achieve this?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [December 8, 2023, 4:38pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-update-the-last-run-metadata-file-in-the-output-plugin/348919/2 "2023-12-08T16:38:48Z")

</div>

> [@gayatri\_SN](#):
>
> Is there any way to achieve this?

No. You cannot make the input depend on the successful output of an event.

---

<div class="post-metadata">

### Author: ![gayatri\_SN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gayatri_sn/32/105321_2.png) [@gayatri\_SN](https://discuss.elastic.co/u/gayatri_SN)
#### Post date: [December 11, 2023, 10:02am UTC](https://discuss.elastic.co/t/is-there-any-way-to-update-the-last-run-metadata-file-in-the-output-plugin/348919/3 "2023-12-11T10:02:30Z")

</div>

Thanks. Your sentences are almost correct, but I've made a small adjustment for clarity:

I am new to Logstash. The JDBC input is not returning anything, yet my file in the output plugin is getting updated at the same time as my configuration pipeline is executing. I am passing the value to write in the file, which is coming from the database, i.e., (datetime %{dt}), but this value does not exist. So why is the output plugin updating the file if the value is not present? The second question is, if there is a 404 encounter in retry\_failure in the Elasticsearch filter plugin, does the retry functionality not work?"  
my snipet is like below

input{  
jdbc{  
last\_run\_metadata\_path =\> \<filepath/sql\_last\_value.yml  
statement\_filepath =\> \<filepath/query.sql\>  
schedule =\> "\*/1 \* \* \* \*"  
}}  
filter{  
elasticsearch{  
hosts =\> "host:port"  
index =\> indexname  
retry\_on\_satus =\> [400,404,403,503,500,504]  
retry\_on\_failure =\> 5  
query\_template =\> \<filepath/query\_template.json\>  
username =\>  
password =\>  
}  
mutate{  
add\_field =\> {"[additionalInfo][created]" =\> "%{dt}"}  
}  
}  
output{  
file {  
path =\> \<filepath/sql\_last\_value.yml\>  
codec =\> line { foramt =\> "datetime '%{[additionalInfo][created]}'"}  
write\_behavior =\> "overwrite"  
}  
}

---

<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: [January 8, 2024, 10:02am UTC](https://discuss.elastic.co/t/is-there-any-way-to-update-the-last-run-metadata-file-in-the-output-plugin/348919/4 "2024-01-08T10:02:48Z")

</div>

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