# Question about JDBC input plugin's last\_run\_metadata\_path setting

**URL:** <https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036>\
**Category:** Logstash\
**Created:** [December 15, 2017, 7:20pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036 "2017-12-15T19:20:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arisbanach](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@arisbanach](https://discuss.elastic.co/u/arisbanach)\
**Post date:** [December 15, 2017, 7:20pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/1 "2017-12-15T19:20:10Z")

</div>

I am using the last\_run\_metadata\_path do define where the file it uses for persistence is kept. The documentation says that the default value for this is `"/home/ph/.logstash_jdbc_last_run"`, but there is no such file or directory on my server. I believe this is causing it to not work. I read in a forum that others were having the same issue, and that trying to set it to a file in $HOME also has problems because of read/write user permissions.

As suggested in the forum, I set my path to `/tmp/.jdbc_metrics-buffalonews_last_run` and it is now working for me, but I am concerned because, from what I understand, the `tmp` directory is only temporary. Wouldn't that mean whenever `tmp` gets cleared that that file will be removed and that Logstash won't remember where it left off?

Am I misunderstanding something?

Thank you.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 18, 2017, 6:27am UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/2 "2017-12-18T06:27:21Z")

</div>

No, you're right. /tmp is usually cleared upon reboot and is therefore not suitable for this purpose.

I see no reason why there should be a general problem storing the file somewhere under $HOME.

---

<div class="post-metadata">

**Author:** ![arisbanach](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@arisbanach](https://discuss.elastic.co/u/arisbanach)\
**Post date:** [December 18, 2017, 4:05pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/3 "2017-12-18T16:05:10Z")

</div>

Ah, I might have been misdiagnosing the issue. I have one very long running import using JDBC paging so that it splits it up into queries of 100000 limits. When does Logstash generate the `jdbc_last_run` file? When the entire pipeline ends? Or when the last output happened?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 18, 2017, 4:08pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/4 "2017-12-18T16:08:28Z")

</div>

Not sure OTOH. Check the source code?

---

<div class="post-metadata">

**Author:** ![arisbanach](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@arisbanach](https://discuss.elastic.co/u/arisbanach)\
**Post date:** [December 22, 2017, 6:23pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/5 "2017-12-22T18:23:32Z")

</div>

Hi @magnusbaeck, I tried changing the path and it's giving me the following error now:

```
  Error: Permission denied - /home/ubuntu/.jdbc_metrics_last_run
  Exception: Errno::EACCES
  Stack: org/jruby/RubyIO.java:3622:in `write'
/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.2/lib/logstash/inputs/jdbc.rb:284:in `update_state_file'
/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.2/lib/logstash/inputs/jdbc.rb:257:in `run'
/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:524:in `inputworker'
/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:517:in `block in start_input'

```

Am I setting the path wrong?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 31, 2017, 1:11pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/6 "2017-12-31T13:11:06Z")

</div>

No, but it looks like the user running Logstash doesn't have write access to ~ubuntu/.jdbc\_metrics\_last\_run.

---

<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 28, 2018, 1:11pm UTC](https://discuss.elastic.co/t/question-about-jdbc-input-plugins-last-run-metadata-path-setting/112036/7 "2018-01-28T13:11:08Z")

</div>

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