# Problem with exec output

**URL:** <https://discuss.elastic.co/t/problem-with-exec-output/49072>\
**Category:** Logstash\
**Created:** [May 3, 2016, 3:05pm UTC](https://discuss.elastic.co/t/problem-with-exec-output/49072 "2016-05-03T15:05:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcmga](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@marcmga](https://discuss.elastic.co/u/marcmga)\
**Post date:** [May 3, 2016, 3:05pm UTC](https://discuss.elastic.co/t/problem-with-exec-output/49072/1 "2016-05-03T15:05:45Z")

</div>

Hello,

I'm having problems when using exec output.  
What i'm trying is exec a command. This command is aws cli (which is installed).  
However i get no errors when logstash executes the command.

I think it deals with the user "logstash" who is running logstash. I don't know how may i execute that command with another user.  
If i try sudo -S ... aws ... it won't work as i don't know the password of the user logstash (created auto when installs ELK).

How may i proceed?

Thank you

---

<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:** [May 8, 2016, 6:59pm UTC](https://discuss.elastic.co/t/problem-with-exec-output/49072/2 "2016-05-08T18:59:37Z")

</div>

The exec output doesn't allow you to select which user to run the command as. A major reason for this is that Logstash typically runs as the logstash user which can't change its effective uid. You have a number of options:

- Change file permissions or whatever so that the logstash user can run the aws command.
- Write a service that runs as a user with access to run the aws command and have Logstash fire requests to that service via some output.
- Create a setuid binary that invokes aws as another user.
- Allow the logstash user to run the aws command via password-less sudo.
- Run Logstash as root and use su or sudo.

---

<div class="post-metadata">

**Author:** ![marcmga](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@marcmga](https://discuss.elastic.co/u/marcmga)\
**Post date:** [May 9, 2016, 7:25am UTC](https://discuss.elastic.co/t/problem-with-exec-output/49072/3 "2016-05-09T07:25:25Z")

</div>

Hi Magnus,

Before writing the post i tried the firts and 4th options with no success.  
Finally i have had success with your second option.

Thanks

---

<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 6, 2017, 4:58am UTC](https://discuss.elastic.co/t/problem-with-exec-output/49072/4 "2017-07-06T04:58:38Z")

</div>

Closed on July 6, 2017, 4:58am UTC


