Mutate converts integer to string

We have the following filter (Logstash 6.2 Windows):

if [category] == "hybrisserver" and [raw] =~ "Starting up hybris server" {
	mutate { update => {"priority" => 2 "category" => "ServerStart" } }
}

The incoming events have priority as an integer (see 2nd event in screenshot below) but after mutate it's a string:

image

This is true. Update replaces the current value of a field with a string. You could convert the field if you need it to be an integer.

Are you stating the obvious :wink: or saying this is by design?

IMHO it's a bug.

Just to be clear: "priority" is not really in the input. It's created via the following filter:

translate {
	field => "type"
	destination => "priority"
	dictionary => {
		"ERROR" => 3
		"WARN" => 2
		"INFO" => 1
		"DEBUG" => 0
	}
}

IMHO it's a bug.

I agree. Logstash's configuration language doesn't have integer literals, and quotes are optional for strings so 2 is treated as "2".

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