How to use LruRedux cache in ruby filter

Somehow we have some logs having duplicated events, we want to dedup the events using fingerprint and LRU cache in the logstash pipeline, So I write a ruby file

require "lru_redux"

def register(params)
    limit = params["size"]
    @processedEvents = LruRedux::TTL::ThreadSafeCache.new(limit, 3600 )
end

def filter(event)
	return [event]
end

When i try to load the script and test, logstash report :
he given configuration is invalid. Reason: Unable to configure plugins: (ScriptError) Error during load of '/Users/i337803/Workspaces/mcap/email-loganalyzer/email-loganalyzer-logstash/src/main/logstash/scripts/dedup.rb': #<NoMethodError: undefined method `<' for nil:NilClass>

I don't see the operator '<' in my file, What does this error complain about, I have no idea?

BTW, I see the Lru is already installed in the official Logstash package.

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