# Cron job

**URL:** <https://discuss.elastic.co/t/cron-job/91820>\
**Category:** Logstash\
**Created:** [July 5, 2017, 1:32am UTC](https://discuss.elastic.co/t/cron-job/91820 "2017-07-05T01:32:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Padmavathy](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Padmavathy](https://discuss.elastic.co/u/Padmavathy)\
**Post date:** [July 5, 2017, 1:32am UTC](https://discuss.elastic.co/t/cron-job/91820/1 "2017-07-05T01:32:26Z")

</div>

Can someone provide me clarification on the below points

[1.Is](http://1.Is) it possible to set a cron job so that it fetches records on a weekly basis(Example:every sunday)  
2.While setting as a cron job the records are fetched from [beginning.Is](http://beginning.Is) there a way to fetch only the updated records and not load records from beginning

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 5, 2017, 1:47am UTC](https://discuss.elastic.co/t/cron-job/91820/2 "2017-07-05T01:47:24Z")

</div>

Records from what?

---

<div class="post-metadata">

**Author:** ![Padmavathy](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Padmavathy](https://discuss.elastic.co/u/Padmavathy)\
**Post date:** [July 5, 2017, 1:48am UTC](https://discuss.elastic.co/t/cron-job/91820/3 "2017-07-05T01:48:05Z")

</div>

I take records using logstash from oracle database

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 5, 2017, 1:51am UTC](https://discuss.elastic.co/t/cron-job/91820/4 "2017-07-05T01:51:43Z")

</div>

Have you seen [https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#\_scheduling](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#_scheduling)?

---

<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:** [July 5, 2017, 6:36am UTC](https://discuss.elastic.co/t/cron-job/91820/5 "2017-07-05T06:36:19Z")

</div>

> While setting as a cron job the records are fetched from beginning.Is there a way to fetch only the updated records and not load records from beginning

Yes, see what the documentation says about the `sql_last_value` parameter. You can use it to restrict the resutl set to only include rows added/updated since the 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:** [August 2, 2017, 6:36am UTC](https://discuss.elastic.co/t/cron-job/91820/6 "2017-08-02T06:36:20Z")

</div>

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