Aggregate Filter exception for Oracle Query


(Aj Vignesh) #1

Hi Team

I am applying an aggreagate filter to the simple oracle query and getting below error.
We have multiple names for a single ID and I am trying to create something like below.

Kindly find error got and yml used for the operation.

{ "country_name": "France", "towns": [ {"town_name": "Paris"}, {"town_name": "Marseille"} ] }
{ "country_name": "USA", "towns": [ {"town_name": "New-York"} ] }

Error:

[ERROR][logstash.filters.aggregate] Aggregate exception occurred {:error=>#<NoMethodError: undefined method `<<' for nil:NilClass>, :code=>"\n\t map['id'] << { 'id' => event.get('id') }\n\t map['synonyms'] ||= []\n map['synonym'] << {'name' => event.get('name')}\n\t event.cancel() ", :map=>{}, :event_data=>{"@timestamp"=>2018-03-09T17:46:24.959Z, "ccid"=>#BigDecimal:67f5406,'0.2E9',1(12), "@version"=>"1", "name"=>"sample"}}

LogStash.yml :

input {
jdbc {
jdbc_validate_connection => true
jdbc_connection_string => ""
jdbc_user => ""
jdbc_password => ""
jdbc_driver_library => "/home/cloud-user/ojdbc6.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
statement => "select all_table .ID id, all_table2 .NAME name
from all_table
inner join all_table2 on all_table .id = all_table2 .id
where rownum < 10000"
}
}
filter {
aggregate {
task_id => "%{id}"
code => "
map['id'] << { 'id' => event.get('id') }
map['synonyms'] ||= []
map['synonym'] << {'name' => event.get('name')}
event.cancel() "
push_previous_map_as_event => true
timeout => 5
}
}
output {
elasticsearch
{
hosts => ["https://XXXX.xx..xxx:9200"]
index => "cconect"
user => ****
password => *********
ssl_certificate_verification => false
}
}


(system) #2

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