# Logstash exec input plugin empty message

**URL:** <https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316>\
**Category:** Logstash\
**Created:** [July 25, 2019, 8:08pm UTC](https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316 "2019-07-25T20:08:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtudisco](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mtudisco](https://discuss.elastic.co/u/mtudisco)\
**Post date:** [July 25, 2019, 8:08pm UTC](https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316/1 "2019-07-25T20:08:05Z")

</div>

Hi, i'm trying to use logstash exec input plugin to run a shell script, however i'm not getting any result.

i have a sample shell script  
/scripts/myscript.sh  
the contents is just  
ls

if i start logstash with the following configuration:  
input {  
exec {  
command =\> "/script/myscript.sh"  
interval =\> 60  
type =\> "test"  
}  
}  
output {  
stdout { codec =\> rubydebug }  
elasticsearch { hosts =\> ["localhost:9200"]  
index =\> "myindex-%{[type]}-%{+YYYY.MM.dd}"  
}  
}

then the message is empty, however if i start with:  
input {  
exec {  
command =\> "ls"  
interval =\> 60  
type =\> "test"  
}  
}  
output {  
stdout { codec =\> rubydebug }  
elasticsearch { hosts =\> ["localhost:9200"]  
index =\> "myindex-%{[type]}-%{+YYYY.MM.dd}"  
}  
}

then message has the output of ls.  
Why are shell scripts not running or not returning what they should?  
This is just a simple test, in my case i need to put more logic on the shell script, if it would be simple would just use the second option.

Any idea?

---

<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:** [July 25, 2019, 8:34pm UTC](https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316/2 "2019-07-25T20:34:31Z")

</div>

Is /script/myscript.sh executable? Are there any errors in the logstash logs?

---

<div class="post-metadata">

**Author:** ![mtudisco](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mtudisco](https://discuss.elastic.co/u/mtudisco)\
**Post date:** [July 25, 2019, 8:46pm UTC](https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316/3 "2019-07-25T20:46:10Z")

</div>

Yes of course

---

<div class="post-metadata">

**Author:** ![mtudisco](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mtudisco](https://discuss.elastic.co/u/mtudisco)\
**Post date:** [July 26, 2019, 8:38pm UTC](https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316/4 "2019-07-26T20:38:53Z")

</div>

finally i made it to work, had to change line  
command =\> "/script/myscript.sh"

to

command =\> "sh -c /script/myscript.sh"

Dont know it thats the way it should be used, but it worked.

---

<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 23, 2019, 8:39pm UTC](https://discuss.elastic.co/t/logstash-exec-input-plugin-empty-message/192316/5 "2019-08-23T20:39:08Z")

</div>

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