# Any alternatives to if and mutate?

**URL:** https://discuss.elastic.co/t/any-alternatives-to-if-and-mutate/48109
**Category:** Logstash
**Created:** [April 21, 2016, 11:04pm UTC](https://discuss.elastic.co/t/any-alternatives-to-if-and-mutate/48109 "2016-04-21T23:04:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [April 21, 2016, 11:04pm UTC](https://discuss.elastic.co/t/any-alternatives-to-if-and-mutate/48109/1 "2016-04-21T23:04:22Z")

</div>

Hi all,

I have a bunch of `if + mutate` that check dst-port field and then update the protocol field to a correct protocol name ( for custom destination port that cannot be recognized by nProbe)

```auto
filter {
if [dst-port] == 5601 {
		mutate {
			update => { "protocol" => "Kibana" }
		}
	}

if [dst-port] == 9200 {
		mutate {
			update => { "protocol" => "Elasticsearch" }
		}
	}	
}

```

Problem is that with about 10 **if** blocks, Logstash throughput significantly drops. Because netflow uses indexing time as the timestamp, throughput drop is not acceptable. I've looked at the mutate filter itself, but is there any better way to accomplish such check and rename operation?

Thanks

---

<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: [April 22, 2016, 5:58am UTC](https://discuss.elastic.co/t/any-alternatives-to-if-and-mutate/48109/2 "2016-04-22T05:58:32Z")

</div>

The translate filter?

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [April 22, 2016, 6:35am UTC](https://discuss.elastic.co/t/any-alternatives-to-if-and-mutate/48109/3 "2016-04-22T06:35:50Z")

</div>

I'll try the translate filter. I forgot to use if + else if, I guess it would somewhat reduce the performance impact

---

<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: [July 6, 2017, 5:01am UTC](https://discuss.elastic.co/t/any-alternatives-to-if-and-mutate/48109/4 "2017-07-06T05:01:10Z")

</div>


