# Problem with mutate - convert and mutate - rename

**URL:** https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150
**Category:** Logstash
**Created:** [August 21, 2019, 3:45pm UTC](https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150 "2019-08-21T15:45:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![franco.federico](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@franco.federico](https://discuss.elastic.co/u/franco.federico)
#### Post date: [August 21, 2019, 3:45pm UTC](https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150/1 "2019-08-21T15:45:55Z")

</div>

Hi all

I make a filter to intercept the log of squid.

I make a pattern with grok debug that run and convert the various fields in fields in elasticsearch.

I'm trying to apply ECS Schema and for 2 fields I have first apply mutate - convert and then apply mutate - rename.

I convert 2 fields from string to integer and then rename it.

I found that the 2 fields are correctly renamed but I have 2 strings.

the piece of mutate is the following

```
filter {
      mutate {
        convert => { "http_response_bytes" => "integer" }
        convert => { "process_elapsed" => "integer" }

        rename => { "http_response_bytes" => "http.response.bytes"} 
        rename => { "process_elapsed" => "process.elapsed"} 
  }
}

```

I'm trying in different mode. The only convert **process\_elapsed** without rename it's work. If I change the position of rename and convert it's work but in my mind it's the same convert and then rename and rename and then convert.

What is the problem with my configuration? I spend different hours to debug and found the other solution.

Thank you  
Franco

---

<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: [August 21, 2019, 4:09pm UTC](https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150/2 "2019-08-21T16:09:09Z")

</div>

mutate does things in a [fixed order](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-proc_order), and rename comes before convert, so the fields no longer exist when it tries to convert them. Split it into two mutate filters.

---

<div class="post-metadata">

### Author: ![franco.federico](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@franco.federico](https://discuss.elastic.co/u/franco.federico)
#### Post date: [August 21, 2019, 5:11pm UTC](https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150/3 "2019-08-21T17:11:23Z")

</div>

Thank you @Badger. So If change my filter in this mode

```
filter {
      mutate {
        convert => { "http_response_bytes" => "integer" }
        convert => { "process_elapsed" => "integer" }
  }
      mutate {
        rename => { "http_response_bytes" => "http.response.bytes"} 
        rename => { "process_elapsed" => "process.elapsed"} 
  }
}

```

So the problem is the order, **mutate** doesn't follow the order with I use but the processing order.

In the log logstash-plain.log I don't found error. I expected to found a message like **http\_response\_bytes** doesn't exist or similar. Why?

Thank you  
Franco

---

<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: [August 21, 2019, 5:41pm UTC](https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150/4 "2019-08-21T17:41:11Z")

</div>

In most cases if the source field for a filter does not exist then the filter is a no-op, it does not log an error or tag on failure (for filters where that applies).

---

<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: [September 18, 2019, 5:41pm UTC](https://discuss.elastic.co/t/problem-with-mutate-convert-and-mutate-rename/196150/5 "2019-09-18T17:41:19Z")

</div>

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