# How to get file plugin work with the codec I developed

**URL:** <https://discuss.elastic.co/t/how-to-get-file-plugin-work-with-the-codec-i-developed/117108>\
**Category:** Logstash\
**Created:** [January 25, 2018, 7:33pm UTC](https://discuss.elastic.co/t/how-to-get-file-plugin-work-with-the-codec-i-developed/117108 "2018-01-25T19:33:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan.W](https://avatars.discourse-cdn.com/v4/letter/n/f17d59/32.png) [@Nathan.W](https://discuss.elastic.co/u/Nathan.W)\
**Post date:** [January 25, 2018, 7:33pm UTC](https://discuss.elastic.co/t/how-to-get-file-plugin-work-with-the-codec-i-developed/117108/1 "2018-01-25T19:33:56Z")

</div>

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:

> **[nathan-ca/logstash-java-plugin-from-zero](https://github.com/nathan-ca/logstash-java-plugin-from-zero)**
>
> logstash-java-plugin-from-zero - A sample logstash plugin for java developer with zero experience of jruby and plugin development

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 22, 2018, 7:34pm UTC](https://discuss.elastic.co/t/how-to-get-file-plugin-work-with-the-codec-i-developed/117108/2 "2018-02-22T19:34:02Z")

</div>

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