# Is it possible to use payload as input to an exec output command?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-use-payload-as-input-to-an-exec-output-command/256042>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 19, 2020, 9:26pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-payload-as-input-to-an-exec-output-command/256042 "2020-11-19T21:26:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![esguy](https://avatars.discourse-cdn.com/v4/letter/e/7ba0ec/32.png) [@esguy](https://discuss.elastic.co/u/esguy)\
**Post date:** [November 19, 2020, 9:26pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-payload-as-input-to-an-exec-output-command/256042/1 "2020-11-19T21:26:02Z")

</div>

Hello,

I have a watcher set up with multiple email actions where each email action has a conditional checking whats in the user field of the payload. For example, if user = 'userGroupA', then it will execute the action that sends email to Group A.

What I would like however, is instead of having a hardcoded list of whether user field = X, I would like to run a shell command that would return user information based on the user field within the payload as input.

Could I do something along the lines of:

```auto
output {
      if [user] == "userGroupA" {
        exec {
          command => "ldap <user>"
        }
      }
    }

```

If this is possible, could I then use that output elsewhere in the watch?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 19, 2020, 10:18pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-payload-as-input-to-an-exec-output-command/256042/2 "2020-11-19T22:18:14Z")

</div>

There is no `exec` type action for Alerting sorry to say - [https://www.elastic.co/guide/en/elasticsearch/reference/current/actions.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/actions.html)

---

<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:** [December 17, 2020, 10:18pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-payload-as-input-to-an-exec-output-command/256042/3 "2020-12-17T22:18:14Z")

</div>

Closed on December 17, 2020, 10:18pm UTC

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