Hi,
I am trying to understand what is wrong with my aggregation:
My code:
aggregate {
task_id => "%{ResolutionDate}"
code => "
map['Date'] = event.get('ResolutionDate')
map['TotalNonPrimeTimeUnavailabilityinSeconds'] ||= 0
map['TotalNonPrimeTimeUnavailabilityinSeconds'] += event.get('NonPrimeTimeUnavailabilityinSeconds')
map['TotalBusinessTimeUnavailabilityinSeconds'] ||= 0
map['TotalBusinessTimeUnavailabilityinSeconds'] += event.get('BusinessTimeUnavailabilityinSeconds')
if event.get('Classification').eql?('High')
map['CountClassificationHigh'] ||= 0; map['CountClassificationHigh'] += 1;
elsif event.get('Classification').eql?('Low')
map['CountClassificationLow'] ||= 0; map['CountClassificationLow'] += 1;
end
#event.cancel()
"
push_previous_map_as_event => true
map_action => "create_or_update"
push_map_as_event_on_timeout => true
timeout => 300
inactivity_timeout => 30
}
The error:
[2019-02-16T12:04:28,410][ERROR][logstash.filters.aggregate] Aggregate exception occurred {:error=>#<TypeError: nil can't be coerced into Fixnum>, :code=>"\n map['Date'] = event.get('ResolutionDate')\n map['TotalNonPrimeTimeUnavailabilityinSeconds'] ||= 0 \n map['TotalNonPrimeTimeUnavailabilityinSeconds'] += event.get('NonPrimeTimeUnavailabilityinSeconds')\n map['TotalBusinessTimeUnavailabilityinSeconds'] ||= 0 \n map['TotalBusinessTimeUnavailabilityinSeconds'] += event.get('BusinessTimeUnavailabilityinSeconds')\n if event.get('Classification').eql?('High')\n map['CountClassificationHigh'] ||= 0; map['CountClassificationHigh'] += 1; \n elsif event.get('Classification').eql?('Low')\n map['CountClassificationLow'] ||= 0; map['CountClassificationLow'] += 1;\n end\n #event.cancel()\n ", :map=>{"Date"=>2018-09-10T05:22:16.000Z, "TotalNonPrimeTimeUnavailabilityinSeconds"=>0}, :event_data=>{"Status"=>"Fechado", "Organization Support Group"=>"Sustenta\\xE7\\xE3o", "Create Date"=>"2018-09-09 16:20:24", "INCIDENTE"=>"INC000004054472", "Company"=>"AMDOCS do Brasil", "Resolution Date"=>"2018-09-10 08:22:16", "BusinessTimeContractCommitment"=>"99.5", "@metadata"=>{"host"=>"SHARONSA03", "path"=>"C:/Users/sharonsa/Work/GSS/VIVO/kpi/BaseIncidentes.csv"}, "type"=>"csv", "message"=>"INC000004054472,Fechado,AMDOCS do Brasil,Sustenta\\xE7\\xE3o,Suporte Funcional N2 - OMS - Ordens,2018-09-09 16:20:24,2018-09-10 08:22:16,,,\\r", "CreateDate"=>2018-09-09T13:20:24.000Z, "Designated Group"=>"Suporte Funcional N2 - OMS - Ordens", "path"=>"C:/Users/sharonsa/Work/GSS/VIVO/kpi/BaseIncidentes.csv", "@timestamp"=>2019-02-16T10:04:25.361Z, "NonPrimeTimeContractCommitment"=>"98", "Classification"=>"\\r", "@version"=>"1", "host"=>"SHARONSA03", "ResolutionDate"=>2018-09-10T05:22:16.000Z}}
Thanks
Sharon