Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB field contains an object, causing serialization issues #5

Open
mshirley opened this issue Dec 8, 2015 · 1 comment · May be fixed by #6
Open

DB field contains an object, causing serialization issues #5

mshirley opened this issue Dec 8, 2015 · 1 comment · May be fixed by #6

Comments

@mshirley
Copy link

mshirley commented Dec 8, 2015

logstash 2.1.0

When reading from an sqlite database the plugin seems to be generating an Event with a ruby object in the db field.

"db" => #<Sequel::JDBC::Database: "jdbc:sqlite:/tmp/myfile.sqlite">

This is preventing logstash from using this event and serializing it into json for output.

LogStash::Json::GeneratorError: Cannot find Serializer for class: org.jruby.RubyObject
     jruby_dump at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.0-  java/lib/logstash/json.rb:53
        to_json at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.0-java/lib/logstash/event.rb:158
        receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-pipe-2.0.2/lib/logstash/outputs/pipe.rb:42
         handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.0-java/lib/logstash/outputs/base.rb:81
    output_func at (eval):27
   outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.0-java/lib/logstash/pipeline.rb:276
  start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.0-java/lib/logstash/pipeline.rb:193

I was able to fix this issue by executing a mutate { remove_field => ['db'] } but it would be handy to have the database location in the event.

My guess is the longterm fix is to change the following line 160:

event = LogStash::Event.new("host" => @host, "db" => @db)

I'm not familiar with the @db object but my guess is that it should contain a method to output the database file path as a string instead of the @db object itself.

@jordansissel
Copy link
Contributor

@mshirley Agreed. This is a bug. Thank you for your excellent details and code walking - should be an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants