# Logstash: Mutate/Add field with variable interpolation not working

**URL:** <https://discuss.elastic.co/t/logstash-mutate-add-field-with-variable-interpolation-not-working/155707>\
**Category:** Logstash\
**Created:** [November 7, 2018, 11:46am UTC](https://discuss.elastic.co/t/logstash-mutate-add-field-with-variable-interpolation-not-working/155707 "2018-11-07T11:46:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [November 7, 2018, 11:46am UTC](https://discuss.elastic.co/t/logstash-mutate-add-field-with-variable-interpolation-not-working/155707/1 "2018-11-07T11:46:51Z")

</div>

The following mutate / field addition with specific value is not working

```
   geoip {
    default_database_type => "ASN"
    source => "dst"
   }

   mutate {
    add_field => ["[dst_asn]", "%{geoip.asn}" ]
    # remove_field => ["geoip"]
   }

```

despite the fact the value exists:

```auto
? dst_asn %{geoip.asn}
# dst_port 80
? geoip.as_org Amazon.com, Inc.
? geoip.asn 16509
? geoip.ip 54.247.167.6

```

Any ideas why?

---

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [November 7, 2018, 11:55am UTC](https://discuss.elastic.co/t/logstash-mutate-add-field-with-variable-interpolation-not-working/155707/2 "2018-11-07T11:55:34Z")

</div>

Doesn't work cause this is not the way to access a nested `json` object...

This is:

`add_field => ["[dst_asn]", "%{[geoip][asn]}" ]`

---

<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 5, 2018, 11:55am UTC](https://discuss.elastic.co/t/logstash-mutate-add-field-with-variable-interpolation-not-working/155707/3 "2018-12-05T11:55:35Z")

</div>

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