Field reference for Numbers

Can I use field references for number fields?

For example I have an aggregate filter with a timeout. The timeout configuration expects a number. I have:

if [type] == "start" {     
	aggregate {
		task_id => "%{filename}"
		code => "[...]"
		map_action => "create"
	}
}

if [type] == "end" {
	aggregate {
		task_id => "%{filename}"
		code => "[...]"
		map_action => "update"
		end_of_task => true
		push_map_as_event_on_timeout => true
		timeout => 7200
		timeout_code => "[...]"
	}
}

The timout is hardcoded to 7200 seconds. I would like to set it via a field reference.
It is documented for strings here: https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references
Is it possible to do this for numbers? I tried:

  • timeout => "[timeout]" (timeout was a field on the event)
  • timeout => "%{timeout} (I pushed the timout to the map beforehand)

But for both variants I get:

  • This setting must be a number. Expected number, got "[timeout]" (type [timeout])
  • or This setting must be a number. Expected number, got "%{timeout}" (type %{timeout})

It is documented to work for environment variables: https://www.elastic.co/guide/en/logstash/current/environment-variables.html

Is it possible to use field references in place of an expected number?

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