# Add new field based on value in event\_data

**URL:** <https://discuss.elastic.co/t/add-new-field-based-on-value-in-event-data/99164>\
**Category:** Beats\
**Tags:** winlogbeat\
**Created:** [September 1, 2017, 6:59pm UTC](https://discuss.elastic.co/t/add-new-field-based-on-value-in-event-data/99164 "2017-09-01T18:59:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maekee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maekee/32/21708_2.png) [@Maekee](https://discuss.elastic.co/u/Maekee)\
**Post date:** [September 1, 2017, 6:59pm UTC](https://discuss.elastic.co/t/add-new-field-based-on-value-in-event-data/99164/1 "2017-09-01T18:59:43Z")

</div>

Hi,  
Trying to add a new field IF event\_data.Status is a specific value. Cant figure out the syntax for Logstash.  
Anyone?

/Maekee

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [September 1, 2017, 7:39pm UTC](https://discuss.elastic.co/t/add-new-field-based-on-value-in-event-data/99164/2 "2017-09-01T19:39:47Z")

</div>

You can use a conditional [mutate filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html).

```auto
filter {
  if [event_data][Status] == "some value" {
    mutate {
        add_field => ["myfield", "foobar"]
    }   
  }
}

```

---

<div class="post-metadata">

**Author:** ![Maekee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maekee/32/21708_2.png) [@Maekee](https://discuss.elastic.co/u/Maekee)\
**Post date:** [September 1, 2017, 8:17pm UTC](https://discuss.elastic.co/t/add-new-field-based-on-value-in-event-data/99164/3 "2017-09-01T20:17:04Z")

</div>

Thanks alot Andrew, just now found the exact same solution.  
Appreciate it!!!

---

<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:** [September 29, 2017, 8:17pm UTC](https://discuss.elastic.co/t/add-new-field-based-on-value-in-event-data/99164/4 "2017-09-29T20:17:08Z")

</div>

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