Logstash error "undefined method `close' for nil:NilClass"


(Navneet Mathpal) #1

Hi ,

I was running logstash in windows environment and it was running fine , but when I was trying the same thing in Linux machine with same version of logstash (1.5.4) it is showing an error
that The error reported is:

undefined method `close' for nil:NilClass

Any idea why ?

Thanks


(Mark Walkom) #2

What does the config look like?
Providing the full error may also be useful.


(Navneet Mathpal) #3

Hi @warkolm
conf file is as follow:

input
{
file
{
path => "/elkt/software/data/error.log"
start_position => "beginning"
sincedb_path => "/elkt/data1.sincedb1"

            }
    }
    filter
    {
            grok
            {
            patterns_dir => "/elkt/software/logstash-1.5.4/patterns"
             match => [ "message" , "%{SYSOUT}"]
            }
            if[classname] == "java.io.NotSerializableException"
            {
            mutate
            {
            remove_field => [ "message" ]
            remove_field => [ "@version" ]
            remove_field => ["host"]
            remove_field => ["path"]
            }
            }

}
output
{

                    stdout { codec => rubydebug }

}

SYSOUT pattern : SYSOUT %{SYSLOG5424SD:date} %{NUMBER:id} %{WORD:waseid} %{GREEDYDATA:data} exception "%{JAVACLASS:classname}" with message "%{JAVACLASS:classname2}". %{GREEDYDATA:additionalinfo}


(Mark Walkom) #4

And the complete error?


(Navneet Mathpal) #5

That is the full error what I am getting after running the logstash

[elkt@server_name bin]$ ./logstash -f syslogs.conf
The error reported is:
undefined method `close' for nil:NilClass
[elkt@server_name bin]$


(andrewvc) #6

Navneet, can you run this with --debug so we can get the full error information? That should printout a stack trace with it.


(Navneet Mathpal) #7

Hi @andrewvc after --debug I am gettting this

The error reported is:
undefined method close' for nil:NilClass /elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/jls-grok-0.11.2/lib/grok-pure.rb:83:inadd_patterns_from_file'
/elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-1.0.0/lib/logstash/filters/grok.rb:361:in add_patterns_from_files' org/jruby/RubyArray.java:1613:ineach'
/elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-1.0.0/lib/logstash/filters/grok.rb:357:in add_patterns_from_files' /elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-1.0.0/lib/logstash/filters/grok.rb:269:inregister'
org/jruby/RubyArray.java:1613:in each' /elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-1.0.0/lib/logstash/filters/grok.rb:265:inregister'
org/jruby/RubyHash.java:1341:in each' /elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-1.0.0/lib/logstash/filters/grok.rb:261:inregister'
org/jruby/RubyArray.java:1613:in each' /elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:155:instart_filters'
/elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/pipeline.rb:82:in run' /elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/agent.rb:155:inexecute'
/elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/runner.rb:90:in run' org/jruby/RubyProc.java:271:incall'
/elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.4-java/lib/logstash/runner.rb:95:in run' org/jruby/RubyProc.java:271:incall'
/elkt/software/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/stud-0.0.21/lib/stud/task.rb:12:in `initialize'


(system) #8