# Mutate beats field

**URL:** https://discuss.elastic.co/t/mutate-beats-field/74940
**Category:** Logstash
**Created:** [February 13, 2017, 11:06pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940 "2017-02-13T23:06:25Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 13, 2017, 11:06pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/1 "2017-02-13T23:06:25Z")

</div>

I cannot seem to get this to work:

`mutate { add_field => { "hostname" => "%{beat.hostname}" } }`

I used this template of code quite a bit and it is working just fine for other items.

---

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 13, 2017, 11:09pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/2 "2017-02-13T23:09:22Z")

</div>

I end up with this, visible from Kibana:

> t hostname %{BEAT.HOSTNAME}

---

<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: [February 14, 2017, 6:45am UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/3 "2017-02-14T06:45:54Z")

</div>

You're using the wrong notation for nested fields.

[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)

---

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 14, 2017, 3:37pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/4 "2017-02-14T15:37:54Z")

</div>

Ohhh, so:

%{[beat].[hostname]} ?

---

<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: [February 14, 2017, 3:41pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/5 "2017-02-14T15:41:30Z")

</div>

No, `%{[beat][hostname]}`.

---

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 14, 2017, 3:44pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/6 "2017-02-14T15:44:38Z")

</div>

Ah....muchas gracias!

---

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 14, 2017, 3:45pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/7 "2017-02-14T15:45:28Z")

</div>

In terms of things like packetbeat and winlogbeat, is there an easy way to change the field names?

I want get some of them in line with other fields names created from my groks.

---

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 14, 2017, 4:22pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/8 "2017-02-14T16:22:30Z")

</div>

I can see in new logs coming in, that worked. Thank you very much sir.

---

<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: [February 14, 2017, 5:45pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/9 "2017-02-14T17:45:56Z")

</div>

> In terms of things like packetbeat and winlogbeat, is there an easy way to change the field names?

I doubt you can change the field names being sent from those tools but you can certainly use Logstash to rename them.

---

<div class="post-metadata">

### Author: ![kopacko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kopacko/32/10733_2.png) [@kopacko](https://discuss.elastic.co/u/kopacko)
#### Post date: [February 14, 2017, 5:55pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/10 "2017-02-14T17:55:57Z")

</div>

Yea true. Didn't want to add any undue cycles unless I needed to.

---

<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: [March 14, 2017, 5:56pm UTC](https://discuss.elastic.co/t/mutate-beats-field/74940/11 "2017-03-14T17:56:00Z")

</div>

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