# How to keep one exec plugin waiting for another?

**URL:** https://discuss.elastic.co/t/how-to-keep-one-exec-plugin-waiting-for-another/198960
**Category:** Logstash
**Created:** [September 10, 2019, 7:02pm UTC](https://discuss.elastic.co/t/how-to-keep-one-exec-plugin-waiting-for-another/198960 "2019-09-10T19:02:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)
#### Post date: [September 10, 2019, 7:02pm UTC](https://discuss.elastic.co/t/how-to-keep-one-exec-plugin-waiting-for-another/198960/1 "2019-09-10T19:02:58Z")

</div>

Given the following configuration:

```
input {
  exec {
    command => "python3 ${LOGSTASH_HOME}/script/firmware/backend/download_script.py"
    schedule => "${SCHEDULER}"
    type => "Backend"
  }
  exec {
    command => "python2 ${LOGSTASH_HOME}/script/firmware/error_parser/parsers/log_parser/parser.py -pp true -lf ${LOGSTASH_HOME}/firmware_data"
    schedule => "${FIRMWARE_SCHEDULER}"
    type => "Firmware"
  }
  file {
	 path => "${LOGSTASH_HOME}/firmware_data/errorcode_diagnostics/*.diag"
	 codec => json
	 start_position => "beginning"
	 sincedb_path => "${LOGSTASH_HOME}/file/.sincedb*"
	 type => "S3"
  }
}

```

**Question:**  
Is there any way I can tell the exec input plugin to wait until `command => "python3 ${LOGSTASH_HOME}/script/..."` is done before it starts executing `command => "python2 ${LOGSTASH_HOME}/script/firmware/error_parser/..."`?

**Note:** The second exec command requires the first exec command to be finished first!

* * *

**Possible solution 1:** Set the time interval for the second command anywhere from 5-10m after the first command to ensure it is processed successfully before it starts.

**Problem:** This approach can sometimes fail if there is a lot of data being processed by the first command, so while the first command is still in process, the second command can kick in and fail.

* * *

**Possible solution 2:** Run the second command in the filter plugin.

**Problem:** This approach doesn't generate any extra fields to use after in the filter plugin or output plugin, only running the script in the input plugin does 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: [September 10, 2019, 7:06pm UTC](https://discuss.elastic.co/t/how-to-keep-one-exec-plugin-waiting-for-another/198960/2 "2019-09-10T19:06:18Z")

</div>

There nothing in logstash that will help you do that. You would have to solve it in the Python scripts.

---

<div class="post-metadata">

### Author: ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)
#### Post date: [September 10, 2019, 7:09pm UTC](https://discuss.elastic.co/t/how-to-keep-one-exec-plugin-waiting-for-another/198960/3 "2019-09-10T19:09:59Z")

</div>

Yes, but I'm not the owner of the second script, so I'm not allowed to make a change.

Solution 2 that I suggested can work, but it doesn't generate any fields such as [message]. Do you know any way that I can get those fields as a result of running the second script in the filter plugin?

---

<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: [October 8, 2019, 7:09pm UTC](https://discuss.elastic.co/t/how-to-keep-one-exec-plugin-waiting-for-another/198960/4 "2019-10-08T19:09:59Z")

</div>

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