Replace one value with another logstash

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

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

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

If you have issues, add ruby debug in output.

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

Yeiiiiiii hahah did work :slight_smile: .

Thank you so much.

Greetings

1 Like

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