Increment field no work

Hello All,

I would like to know how to increment a field when running an event in logstash.

I tried this, but it does not work.

if [Process] == "status"{

   script => "ctx._source.Rej_status++"

}

I want to increment field Rej_status every time when Process == status.

I have this message.

   [ERROR] 2019-03-01 08:16:12.466 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, 
	   :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, at line 57, column 17 (byte 1980) after filter 

Line 57 is script => ...

I have use this

if [Process] == "status"{
ruby {
code => 'event.set("Rej_status", event.get("Rej_status").to_i + 1)'
}
}

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