Writing my own filter plugin. What is the best way to implement the regex matching?

I am learning how to write my own custom filter plugin. Just started. I got the basics.

For my case, the input lines (or events) are like this

key1 = value1
key2 = value2
key6 = value6
key7 = value7

where values can be anything, a number, a single word, a long string, ...

I would like to get, and manipulate, the values for a list of provided keys.
My question is, what is the best way here for me to do the matching?

  1. should I just investigate how to do regular expressions in ruby?
  2. copy & paste from an existing plugin that does the same, or similar? If yes, which one would you recommend?
  3. can a plugin import classes and methods from other plugins? If yes, would be the best way to have my plugin to call, somehow, logstash-filter-grok and let it do it?

Any suggestion or tip is more than welcome.


from the lack of comments, I deduce the answer is (1): implement the regex matching in the code from scratch.

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