# Logstash file plugin schedule

**URL:** <https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456>\
**Category:** Logstash\
**Created:** [June 26, 2018, 3:00pm UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456 "2018-06-26T15:00:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sysdradmin](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sysdradmin](https://discuss.elastic.co/u/sysdradmin)\
**Post date:** [June 26, 2018, 3:00pm UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/1 "2018-06-26T15:00:33Z")

</div>

Hello,

How to cron task with logstash and file plugin ? with jdbc plugin it's integrate but not found with file plugin.

we use start\_interval and discover\_interval but not really work. ( stat\_interval =\> 30  
discover\_interval =\> 30 )

How you do ?

rgds

---

<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:** [June 26, 2018, 5:33pm UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/2 "2018-06-26T17:33:42Z")

</div>

> How to cron task with logstash and file plugin ?

The file input plugin is designed to continuously monitor a set of files. Why would you want to stuff this in a crontab?

> we use start\_interval and discover\_interval but not really work.

What did you try and in what way did it not work?

---

<div class="post-metadata">

**Author:** ![sysdradmin](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sysdradmin](https://discuss.elastic.co/u/sysdradmin)\
**Post date:** [June 27, 2018, 8:59am UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/3 "2018-06-27T08:59:50Z")

</div>

Hello Mr Baeck,

in the folder where logstash is looking for, we have a file ( \*.log) we come in once per day with cron script. ( cron script del old file and build a new files) After that, we launch logstash in cron.

Why cron ? Because when we add stat\_interval =\> 30 and discover\_interval =\> 30 it don't seems working and we launch it because we have others index to run from differents plugins.

In fact, we are looking for a way to say to logstash :

- when you see in the folder1 one new file, you index it according to conf files folder1.conf ( file come once per day )

-when you see new files ( plenty of files come every minutes) in the folder2, you index them according to conf files folder2.conf ( files come from every minutes )

---

<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:** [June 27, 2018, 10:12am UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/4 "2018-06-27T10:12:29Z")

</div>

> - when you see in the folder1 one new file, you index it according to conf files folder1.conf ( file come once per day )
> - when you see new files ( plenty of files come every minutes) in the folder2, you index them according to conf files folder2.conf ( files come from every minutes )

That's easy. Either use multiple pipelines or have a single pipeline and configure each file input to add a tag or a field that identifies each event, and use that tag or field to select which filters and outputs to use.

---

<div class="post-metadata">

**Author:** ![sysdradmin](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sysdradmin](https://discuss.elastic.co/u/sysdradmin)\
**Post date:** [June 27, 2018, 11:01am UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/5 "2018-06-27T11:01:50Z")

</div>

The best easy way was cron 😉

Have you examples or link to ?

---

<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:** [June 27, 2018, 11:09am UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/6 "2018-06-27T11:09:49Z")

</div>

> The best easy way was cron 😉

I don't agree. There's no easy way of shutting down Logstash once the input files have been consumed.

> Have you examples or link to ?

> **[Accessing event data and fields | Logstash Reference \[8.11\] | Elastic](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html)**

---

<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:** [July 25, 2018, 11:09am UTC](https://discuss.elastic.co/t/logstash-file-plugin-schedule/137456/7 "2018-07-25T11:09:56Z")

</div>

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