# Execute a script after harvesting

**URL:** <https://discuss.elastic.co/t/execute-a-script-after-harvesting/128955>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [April 21, 2018, 6:45am UTC](https://discuss.elastic.co/t/execute-a-script-after-harvesting/128955 "2018-04-21T06:45:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![francisaugusto](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@francisaugusto](https://discuss.elastic.co/u/francisaugusto)\
**Post date:** [April 21, 2018, 6:45am UTC](https://discuss.elastic.co/t/execute-a-script-after-harvesting/128955/1 "2018-04-21T06:45:14Z")

</div>

Is it possible to trigger scripts after an event has occurred? It would be nice to run a script to delete a file, for example, if close\_eof is executed. My point is to delete old logs after they have been harvested.

---

<div class="post-metadata">

**Author:** ![adrisr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrisr/32/25423_2.png) [@adrisr](https://discuss.elastic.co/u/adrisr)\
**Post date:** [April 24, 2018, 9:43am UTC](https://discuss.elastic.co/t/execute-a-script-after-harvesting/128955/2 "2018-04-24T09:43:11Z")

</div>

Currently, filebeat doesn't offer any facility to trigger scripts responding to events.

If you want to have files deleted after they have been harvested, have a look at this discussion where different approaches are considered:

> <https://github.com/elastic/beats/issues/714>

---

<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:** [May 22, 2018, 9:43am UTC](https://discuss.elastic.co/t/execute-a-script-after-harvesting/128955/3 "2018-05-22T09:43:29Z")

</div>

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