# Exec input filter in logstash not capturing entire output from python script

**URL:** <https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626>\
**Category:** Logstash\
**Created:** [June 15, 2017, 8:46pm UTC](https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626 "2017-06-15T20:46:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)\
**Post date:** [June 15, 2017, 8:46pm UTC](https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626/1 "2017-06-15T20:46:00Z")

</div>

Here is what my configuration looks like ...

input {  
exec {  
command =\> 'c:\Python27\python C:\J\logstash\pythonscripts\[test.py](http://test.py)'  
interval =\> 10000  
}  
}  
output {  
stdout {  
codec =\> rubydebug  
}  
}

When I execute this python script on commandline, as it does some processing - so there is a delay before the output is printed onto the console.  
However, whatever is the output doesnt make it to the pipeline.  
Also, before the processin, whateever I output to the console, that gets captured in the pipeline.  
Is there like a timeout thingie that pipeline waits for before disconnecting from script output?

Any help would be greatly appreciated!

---

<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 15, 2017, 8:50pm UTC](https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626/2 "2017-06-15T20:50:23Z")

</div>

Can you try to produce a minimal example that exhibits the problem? What if you have a one-line Python script like

```
print 'hello'

```

does that get captured?

---

<div class="post-metadata">

**Author:** ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)\
**Post date:** [June 15, 2017, 8:51pm UTC](https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626/3 "2017-06-15T20:51:40Z")

</div>

yes, that works fine. Even in this script as I said, most the output is captured except until there is that processing and then the output.

---

<div class="post-metadata">

**Author:** ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)\
**Post date:** [June 15, 2017, 8:58pm UTC](https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626/4 "2017-06-15T20:58:27Z")

</div>

Ok so here is a little something I tried.  
I introduced a delay in my script. So now it is something like ...  
print 'hello1'  
sleep (10)  
print 'hello2'

What I noticed in logstash - the pipeline waited until 10 seconds and then received both hello1 and hello2 events.  
so it doesnt look like delay is an issue here.  
Let me look up my script.

---

<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 13, 2017, 8:59pm UTC](https://discuss.elastic.co/t/exec-input-filter-in-logstash-not-capturing-entire-output-from-python-script/89626/5 "2017-07-13T20:59:01Z")

</div>

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