How to get file plugin work with the codec I developed


#1

I'm developing my own codec. I'm new to jruby, so after reading some posts, I figured out how to write the major codec work in Java and call the Java library from jruby code.

The issue is, this codec won't work with file plugin to process line input. I couldn't figure out which part is broken.

Here is the entire source code for my work:

The codec work is in this java code java-plugin/src/main/java/codec/Processor.java. It's trivial, just convert the input into a json string.

The logstash plugin code is under logstash-codec-sample-codec-v2 dir, the code file is logstash-codec-sample-codec-v2/lib/logstash/codecs/sample-codec.rb. This is based on logstash codec template.

After compile and install the plugin ( I used both logstash 5.6.x and 6.0.x versions), it works as I expected. For example, if I use the config file defined in logstash-conf/codec-stdout.conf, it works. For the message I typed at stdin (or using pipe), the codec will convert the message to json message as expected.

However, I couldn't get this codec work with file plugin. The config logstash-conf/file-codec-stdout.conf is the simple config with the codec. Nothing was print out from logstash. If I comment out the "codec" line in the config, it works (change in the files was printout).

I used --verbose and --debug options and couldn't find any helpful info. What's missing in my codec work? How to debug codec code? Any help on this is appreciated.


(system) #2

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