logstash-plugins / logstash-filter-age

Filter to calculate age of an event based on when it was received by Logstash
Apache License 2.0
2 stars 3 forks source link

Enhancement to compare age difference against dynamic acquired limit setting from remote service like elasticsearch cluster settings #3

Open richard-mauri opened 4 years ago

richard-mauri commented 4 years ago

My use case is fairly typical: call age{} in the logstash filter and then compare the target field against some threshold. I could not stand the hard coded magic number limit used in the comparison so I forked the repo and developed a POC enhancment that may result in a subsequent pull request.

I added these config fields:

I used the http_client mixin and I'm folding in the rufus_scheduler gem to do the hard work.

The age class register method makes the http request to the limit service synchronously and starts a periodic schedule to perform the next get request for the age limit.

I am new to logstash and filters and ruby, but so far this is working great. I have concerns about the statefulness of the class instance member access in a multi worker logstash environment. Out of an abundance of caution I am considering adding require require 'jruby/synchronized' and then including JRuby::Synchronized as per https://github.com/jruby/jruby/wiki/Concurrency-in-jruby

I wonder if this enhancement would be useful as a PR or if I should leave it as a fork or develop a completely new alternative to age.

Thoughts?

richard-mauri commented 4 years ago

Please see: https://github.com/logstash-plugins/logstash-filter-age/pull/4