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

rss input is creating objects that can't be serialized #21

Open
rashmivkulkarni opened this issue Jul 1, 2016 · 1 comment
Open

rss input is creating objects that can't be serialized #21

rashmivkulkarni opened this issue Jul 1, 2016 · 1 comment

Comments

@rashmivkulkarni
Copy link

rashmivkulkarni commented Jul 1, 2016

  • Version: Logstash 5.0 alpha4
  • Operating System: OSX 10.10.5
  • Config File
input {
  rss {
    url => "http://stackoverflow.com/feeds/tag/elasticsearch+or+logstash+or+beats+or+kibana"
    interval => 3600
  }
}
output {
 elasticsearch {
    hosts => ["localhost:9200"]
    user => "elastic"
    password => "changeme"
  }
  stdout { }
}
  • Steps to Reproduce:
  1. When I run Logstash with the above config file, I get the following error as mentioned in the stack.
    This seems to be a this is a rss input specific problem.

```An unknown error occurred sending a bulk request to Elasticsearch. We will retry indefinitely {:error_message=>"Failed to load class 'org.joda.time.DateTime$Access4JacksonDeserializer6e1d0360': com.fasterxml.jackson.module.afterburner.ser.BeanPropertyAccessor", :error_class=>"LogStash::Json::GeneratorError", :backtrace=>["/Users/rashmikulkarni1/Documents/ALPHA4FINAL/logstash/logstash-5.0.0-alpha4/logstash-core/lib/logstash/json.rb:52:injruby_dump'", "/Users/rashmikulkarni1/Documents/ALPHA4FINAL/logstash/logstash-5.0.0-alpha4/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-4.1.1-java/lib/logstash/outputs/elasticsearch/http_client.rb:49:in bulk'", "org/jruby/RubyArray.java:1613:in`each'", "org/jruby/RubyEnumerable.java:852:in `inject'", "/Users/rashmikulkarni1/Documents/ALPHA4FINAL/logstash/logstash-5.0.0-alpha4/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-4.1.1-java/lib/logstash/outputs/elasticsearch/http_client.rb:38:in`bulk'", "/Users/rashmikulkarni1/Documents/ALPHA4FINAL/logstash/logstash-5.0.0-alpha4/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-4.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:181:in `safe_bulk'", "/Users/rashmikulkarni1/Documents/ALPHA4FINAL/logstash/logstash-5.0.0-alpha4/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-4.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:105:in`submit'",


@colinsurprenant
Copy link
Contributor

This kind of problem typically happen because the plugin, which relies on an external library (rss), sets a "rogue" object in the Event. By convention, only strings and numeric values (and logstash Timestamp) are valid but not currently validated/enforced upon setting values so the rogue object may survive the pipeline travel until it has to be serialized where logstash cannot figure how to serialize such an object. In this case this is a org.joda.time.DateTime.

Quickly looking at the code I am pretty sure the problem lies here and/or here - these values are probably some kind of date object. This is where I'd add some test harness to validate the Object type which is returned by the rss library and set into the Event.

Note that in the future, these kind of problems will surface immediately at the input plugin where the "bad" object is set and not at some other pipeline stage later on. This also means that such problems will be discovered by any basic plugin test/spec and/or manual tests in the development process.

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

No branches or pull requests

2 participants