# Filter mutate replace field value with value of another field

**URL:** <https://discuss.elastic.co/t/filter-mutate-replace-field-value-with-value-of-another-field/38660>\
**Category:** Logstash\
**Created:** [January 7, 2016, 5:27pm UTC](https://discuss.elastic.co/t/filter-mutate-replace-field-value-with-value-of-another-field/38660 "2016-01-07T17:27:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Clifton](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Chris\_Clifton](https://discuss.elastic.co/u/Chris_Clifton)\
**Post date:** [January 7, 2016, 5:27pm UTC](https://discuss.elastic.co/t/filter-mutate-replace-field-value-with-value-of-another-field/38660/1 "2016-01-07T17:27:36Z")

</div>

Hoping this is a simple syntax issue,

I'm adding a tag to events from filebeat on the client shipper,

```
 fields:
     tag_hostname: "Dev Server"

```

host value is already present in LS, I want to replace the value of the host field with the value in fields.tag\_hostname,

```
 filter {
 mutate {
    update => { "host" => "[fields.tag_hostname]" }
     }
 }

```

I've tried all manner of syntax, ("host" =\> "%{fields.tag\_hostname}" , "host" =\> "%{[fields.tag\_hostname}]" etc , none seem to work, host field keeps being replaced with the literal of whatever is between the quotes. Tried without quotes, of course that doesn't work.

---

<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:** [January 7, 2016, 5:43pm UTC](https://discuss.elastic.co/t/filter-mutate-replace-field-value-with-value-of-another-field/38660/2 "2016-01-07T17:43:23Z")

</div>

```auto
filter {
  mutate {
    update => { "host" => "%{[fields][tag_hostname]}" }
  }
 }

```

See [https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references) and the following section.

---

<div class="post-metadata">

**Author:** ![Chris\_Clifton](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Chris\_Clifton](https://discuss.elastic.co/u/Chris_Clifton)\
**Post date:** [January 7, 2016, 5:49pm UTC](https://discuss.elastic.co/t/filter-mutate-replace-field-value-with-value-of-another-field/38660/3 "2016-01-07T17:49:58Z")

</div>

> [@magnusbaeck](#):
>
> [Accessing event data and fields | Logstash Reference [8.11] | Elastic](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references)

awesome! that's what I was looking for, thanks for the quick reply!

---

<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, 5:16am UTC](https://discuss.elastic.co/t/filter-mutate-replace-field-value-with-value-of-another-field/38660/4 "2017-07-06T05:16:29Z")

</div>


