I'm trying to carry forward a year that is specified infrequently in my logs, and it seemed like the aggregate filter would work beautifully for this, however the filter doesn't seem to actually do anything (I've added the add_tag setting to see if the code was the only problem and the tag wasn't added either) other blocks in the same part of the conditional run fine (I get the one and two lines printed to stdout given the correct input).
if ([timestamp] !~ /.+/) {
drop {}
} else if ([message] =~ /^started/) {
ruby {code=>"puts 'one'"}
aggregate {
task_id => "%{path}"
code => "map['year'] = Time.at(event['timestamp'].to_f).year"
add_tag => ['hi']
}
} else {
ruby {code=>"puts 'two'"}
aggregate {
task_id => "%{path}"
code => "event['timestamp'].gsub!(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/,map['year'].to_s+' \1')"
map_action => "update"
add_tag => ['there']
}
}
I'm completely stumped and hope someone can help.