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

An array of level can have an integer value & event ['tags'] can just be a value not always an array #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

edefaria
Copy link

@edefaria edefaria commented Jul 2, 2015

I found 2 issues:

1/An array of level can have an integer value, currently the code convert to string the level if it just have one value without an array, but when event['level'] is an array, in some rare case, it may crash like that (if integer value is present in the array)
It crashs with the following stack in debug:

NoMethodError: undefined method `downcase' for 6:Fixnum
        receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-gelf-1.0.0/lib/logstash/outputs/gelf.rb:210
         handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/outputs/base.rb:88
    output_func at (eval):77
   outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:243
  start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:165
syslog listener died {:protocol=>:udp, :address=>"0.0.0.0:1513", :exception=>#<SocketError: recvfrom: name or service not known>, :backtrace=>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-syslog-1.0.0/lib/logstash/inputs/syslog.rb:138:in `udp_listener'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-syslog-1.0.0/lib/logstash/inputs/syslog.rb:117:in `server'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-syslog-1.0.0/lib/logstash/inputs/syslog.rb:97:in `run'"], :level=>:warn, :file=>"logstash/inputs/syslog.rb", :line=>"120", :method=>"server"}

2/event ['tags'] can just be a value not always an array
If you setup Logstash into Logstash. A first logstash server with output-gelf, setup grok filter which failed, so it generated tags => ["_grokparsefailure"]. The second logstash server with gelf-input and gelf-output. The event['tags'] has in this case an array of one value on the first logstash server and just a value without an array on the second server.
It crashs with the following stack in debug:

NoMethodError: undefined method `join' for "_grokparsefailure":String
        receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-gelf-0.1.4/lib/logstash/outputs/gelf.rb:178
         handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.1-java/lib/logstash/outputs/base.rb:88
    output_func at (eval):180
   outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.1-java/lib/logstash/pipeline.rb:243
  start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.1-java/lib/logstash/pipeline.rb:165

… 2/A array of level can have an integer value

1/NoMethodError: undefined method `join' for "_grokparsefailure":String
2/NoMethodError: undefined method `downcase' for 6:Fixnum
@edefaria edefaria changed the title A array of level can have an integer value & event ['tags'] can just be a value not always an array An array of level can have an integer value & event ['tags'] can just be a value not always an array Jul 2, 2015
@jordansissel
Copy link
Contributor

Code looks OK to me. Can you add test coverage for this change?

@elasticsearch-release
Copy link

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'.

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

Successfully merging this pull request may close these issues.

3 participants