# Replace one value with another logstash

**URL:** https://discuss.elastic.co/t/replace-one-value-with-another-logstash/324130
**Category:** Logstash
**Created:** [January 27, 2023, 5:53pm UTC](https://discuss.elastic.co/t/replace-one-value-with-another-logstash/324130 "2023-01-27T17:53:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jose\_Campos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_campos/32/11259_2.png) [@Jose\_Campos](https://discuss.elastic.co/u/Jose_Campos)
#### Post date: [January 27, 2023, 5:53pm UTC](https://discuss.elastic.co/t/replace-one-value-with-another-logstash/324130/1 "2023-01-27T17:53:58Z")

</div>

Hi, I was trying to convert the value of one field with another, for example:

I currently have a field called "priority" and the value of that field is = 1, priority=1. What I want to do is change that value 1 to critical, that is, priority=critical.

I made a conditional but it doesn't work, am I doing something wrong?

if [priority] == "1" {  
mutate {  
replace =\> ["priority", "critical"]  
}

Greetings

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [January 27, 2023, 8:42pm UTC](https://discuss.elastic.co/t/replace-one-value-with-another-logstash/324130/2 "2023-01-27T20:42:49Z")

</div>

Depend on data type:  
"1" - string  
1 - integer  
I assume it's number, so:

```auto
if [priority] == 1 {
   mutate { convert => { "priority" => "string" } }
   mutate { replace => ["priority", "critical"] }
}

```

If you have issues, add ruby debug in output.

```auto
output {
    stdout { codec => rubydebug{} }
...
}

```

---

<div class="post-metadata">

### Author: ![Jose\_Campos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_campos/32/11259_2.png) [@Jose\_Campos](https://discuss.elastic.co/u/Jose_Campos)
#### Post date: [January 27, 2023, 8:44pm UTC](https://discuss.elastic.co/t/replace-one-value-with-another-logstash/324130/3 "2023-01-27T20:44:05Z")

</div>

Yeiiiiiii hahah did work 🙂 .

Thank you so much.

Greetings

---

<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: [February 24, 2023, 8:44pm UTC](https://discuss.elastic.co/t/replace-one-value-with-another-logstash/324130/4 "2023-02-24T20:44:11Z")

</div>

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