# Mutate rename filter not working on nested fields

**URL:** <https://discuss.elastic.co/t/mutate-rename-filter-not-working-on-nested-fields/207146>\
**Category:** Logstash\
**Created:** [November 8, 2019, 4:35pm UTC](https://discuss.elastic.co/t/mutate-rename-filter-not-working-on-nested-fields/207146 "2019-11-08T16:35:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Doles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_doles/32/40730_2.png) [@Justin\_Doles](https://discuss.elastic.co/u/Justin_Doles)\
**Post date:** [November 8, 2019, 4:35pm UTC](https://discuss.elastic.co/t/mutate-rename-filter-not-working-on-nested-fields/207146/1 "2019-11-08T16:35:42Z")

</div>

I'm likely missing something simple, but I cannot seem to get the rename filter to work with my data. The field I'm attempting to rename is nested. It doesn't error, but it also doesn't do anything. I am able to rename a field that isn't nested (e.g.) without issue.  
Below is my test config:

```
input {
	file {
		codec => multiline {
          pattern => '^\{'
          negate => true
          what => "previous"
        }
		path => "c:/logstash/test.json"
		start_position => "beginning"
		mode => "read"
		file_completed_action => "log"
		file_completed_log_path => "c:/logstash/test2.json"
		sincedb_path => "NUL"
	}
}

filter {
	json {
		source => message
	}
	mutate {
		rename => {
			"[destination][as][asn]" => "[destination][as][number]"
			"[destination][as][as_org]" => "[destination][as][organization][name]"
		}
	}
}

output {
	stdout { codec => rubydebug }
}

```

Here is the file I'm testing with:

```
{
	"source.as": {
		"asn": 4134,
		"ip": "118.182.21.13",
		"as_org": "No.31,Jin-rong Street"
	},
	"agent.name": "LOGSTASH",
	"source.interface": "X1",
	"@version": "1",
	"message": "Connection Opened",
	"source.ip": "118.182.21.13",
	"destination.port": "1433",
	"network.transport": "tcp",
	"source.geo": {
		"timezone": "Asia/Shanghai",
		"ip": "118.182.21.13",
		"longitude": 103.7922,
		"latitude": 36.0564,
		"location": {
			"lat": 36.0564,
			"lon": 103.7922
		},
		"region_name": "Gansu",
		"country_name": "China",
		"continent_code": "AS",
		"region_code": "GS",
		"country_code3": "CN",
		"country_code2": "CN"
	},
	"destination.interface": "X1",
	"agent.type": "logstash",
	"@timestamp": "2019-11-08T11:36:57.000Z",
	"observer.type": "firewall",
	"source.port": "55705",
	"destination.geo": {
		"city_name": "A City",
		"timezone": "America/New_York",
		"ip": "1.1.1.1",
		"longitude": 74.0060,
		"latitude": 40.7128,
		"location": {
			"lat": 40.7128,
			"lon": 74.0060
		},
		"postal_code": "90210",
		"region_name": "New York",
		"continent_code": "NA",
		"country_name": "United States",
		"region_code": "NY",
		"dma_code": 123,
		"country_code3": "US",
		"country_code2": "US"
	},
	"id": "fwidname",
	"destination.as": {
		"asn": 1234,
		"ip": "1.1.1.1",
		"as_org": "AS Org Name"
	},
	"tags": [
		"syslog",
		"firewall"
	],
	"host.ip": "192.168.0.1",
	"observer.vendor": "firewall",
	"log.original": "LOG ENTRY",
	"observer.ip": "192.168.0.1",
	"destination.ip": "1.1.1.1",
	"observer.serial_number": "ABCD1234"
}
```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 8, 2019, 4:42pm UTC](https://discuss.elastic.co/t/mutate-rename-filter-not-working-on-nested-fields/207146/2 "2019-11-08T16:42:17Z")

</div>

> [@Justin\_Doles](#):
>
> "destination.as": { "asn": 1234, "ip": "1.1.1.1", "as\_org": "AS Org Name" }

You have field names with periods in them. That one would be [destination.as][asn]

---

<div class="post-metadata">

**Author:** ![Justin\_Doles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_doles/32/40730_2.png) [@Justin\_Doles](https://discuss.elastic.co/u/Justin_Doles)\
**Post date:** [November 8, 2019, 7:16pm UTC](https://discuss.elastic.co/t/mutate-rename-filter-not-working-on-nested-fields/207146/3 "2019-11-08T19:16:28Z")

</div>

_facepalm_ I knew I was missing something simple. Switching the fields over worked. Thanks.

---

<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 6, 2019, 7:16pm UTC](https://discuss.elastic.co/t/mutate-rename-filter-not-working-on-nested-fields/207146/4 "2019-12-06T19:16:28Z")

</div>

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