# Rename and sub field dont work

**URL:** <https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940>\
**Category:** Logstash\
**Created:** [May 24, 2017, 10:05am UTC](https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940 "2017-05-24T10:05:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nigdav007](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nigdav007](https://discuss.elastic.co/u/nigdav007)\
**Post date:** [May 24, 2017, 10:05am UTC](https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940/1 "2017-05-24T10:05:13Z")

</div>

Hay All

I am trying to rename and field called "@fields.ctxt\_file" to "file" but it does not work

the config i am using is

```auto
	json {
	    source => "message"
	}
	      mutate {
                  replace => ["message", "%{@message}"]
                  replace => ["host", "%{@source}"]
                  replace => ["programname", "%{@type}"]
                  rename => { "'@fields.ctxt_file'" => "file" }
                  rename => { "'@fields.ctxt_line'" => "line" }
                  rename => { "'@fields.ctxt_user_uuid'" => "user_id" }
                  remove_field => ["@message","@tags", "@version", "@source","@type", "sysloghost"]
            }
 }

```

any advise is welcome and gratefull

---

<div class="post-metadata">

**Author:** ![Nico-DF](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nico-DF](https://discuss.elastic.co/u/Nico-DF)\
**Post date:** [May 24, 2017, 11:08am UTC](https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940/2 "2017-05-24T11:08:08Z")

</div>

> [@nigdav007](#):
>
> "'@fields.ctxt\_file'"

The double quote is what you wrote or you just made a mistake here?

---

<div class="post-metadata">

**Author:** ![nigdav007](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nigdav007](https://discuss.elastic.co/u/nigdav007)\
**Post date:** [May 24, 2017, 12:04pm UTC](https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940/3 "2017-05-24T12:04:34Z")

</div>

I tried  
"'@fields.ctxt\_file'" and  
"@fields.ctxt\_file"

both failed to work

---

<div class="post-metadata">

**Author:** ![nigdav007](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nigdav007](https://discuss.elastic.co/u/nigdav007)\
**Post date:** [May 24, 2017, 12:14pm UTC](https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940/4 "2017-05-24T12:14:25Z")

</div>

Worked it out  
it should be

```auto
rename => { "[@fields][ctxt_file]" => "file" }

```

---

<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:** [June 21, 2017, 12:15pm UTC](https://discuss.elastic.co/t/rename-and-sub-field-dont-work/86940/5 "2017-06-21T12:15:09Z")

</div>

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