logstash-plugins / logstash-input-couchdb_changes

This plugin captures the _changes stream from a CouchDB instance
Apache License 2.0
27 stars 22 forks source link

Fix support for error response code from CouchDB #29

Closed YannRobert closed 8 years ago

YannRobert commented 8 years ago

This set of commits should ease debugging when bad configuration of logstash makes CouchDB return an error level HTTP response code.

without that PR, when you provide invalid credentials, you end up with

Error: undefined method `[]' for nil:NilClass\n  Exception: NoMethodError\n  Stack: /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-couchdb_changes-2.0.2/lib/logstash/inputs/couchdb_changes.rb:207:in `build_event'\n/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-couchdb_changes-2.0.2/lib/logstash/inputs/couchdb_changes.rb:159

with that PR, you end up with

{:timestamp=>"redacted", :message=>"Unable to connect to database", :db=>"redacted", :error=>"{:message=>\"Authentication error!\", :response_code=>\"401\"}", :level=>:error, :file=>"logstash/inputs/couchdb_changes.rb", :line=>"182", :method=>"run"}

which is much better I think.

I believe this should fix #19

YannRobert commented 8 years ago

I just signed the CLA

elasticsearch-release commented 8 years ago

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run; then say 'jenkins, test it'.