I try to read from a json file but codec=>"json_lines" won't work, can't see any output. But when i try and set codec=>"json" it works and parses the data and i see the output.
So you ask me what is the format of the json file. Well the json file was records from beats that i save into a file. So the output must be by defaultjson_lines as the docs state. So i cannot see why is this happening...
Also i found out that while using the codec=>"json" in the input file plugin, i thought it worked ok but i got this error at the begging which is related to my filter:
Error parsing json {:source=>"destination", :raw=>{"ip"=>"127.0.0.1", "bytes"=>0, "port"=>16443, "packets"=>0}, :exception=>java.lang.ClassCastException: class org.jruby.RubyHash cannot be cast to class org.jruby.RubyIO (org.jruby.RubyHash and org.jruby.RubyIO are in unnamed module of loader 'app'
The documentation explains why json_lines does not work with a file input. json_lines expects a stream of lines separated by newlines. The file input strips the newline from a line, so the json_lines codec never thinks it has seen the end of the line.
The ClassCastException suggests to me that you do not need the json filter, that the [destination] field was already parsed by the json codec. You can see that [destination] is a RubyHash.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.