Import external ruby file for aggregate filter - performance tuning

In my logstash configuration file I have following code in serveral places with slight changes.

aggregate {
                    task_id => "%{tid}"
                    code => "
                        require '/etc/logstash/conf.d/aggregate.rb'
                        AggregateCode.aggregate_request(event, map)
                    map_action => "create"

Though It works, it takes more time than keeping original code in 'code' option. It is obvious that reason for that is importing external file in the 'code' option.

Is there a way to initialize the aggregate.rb file once for all time, then it would be used everywhere the above code exists. something like this in aggregate filter?

ruby  {
init=>"require '/etc/logstash/conf.d/aggregate.rb'"

Or any other suggestion for better performance?

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