Error: undefined method `path' for nil:NilClass from file input

Hi,
I am using logstash 6.4.0 on windows

My config looks loke this:

input {
	stdin {}
	
	file {
		path => "D:/tmp/xmlTest/**/*.xml"
		type => "fooBar"
		mode => "read"

		codec => plain {
			charset => "ISO-8859-1"
		}
		
		file_completed_action => "log"
		file_completed_log_path => "d:/tmp/completedXmls.txt"
		
		sincedb_path => "d:/tmp/sincedb_readMode"
	}
}

output {
	stdout {
		codec => rubydebug
	}
}

I have a couple of ISO-8859-1 encoded text files in my test directory (d:\tmp\xmlTest). When I start logstash it logs the following:

[2018-09-18T17:10:54,419][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.4.0"}
[2018-09-18T17:10:59,418][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
The stdin plugin is now waiting for input:
[2018-09-18T17:11:00,312][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x4715877d run>"}
[2018-09-18T17:11:00,393][INFO ][filewatch.observingread  ] START, creating Discoverer, Watch with file and sincedb collections
[2018-09-18T17:11:00,394][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2018-09-18T17:11:00,906][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2018-09-18T17:11:01,657][ERROR][logstash.pipeline        ] A plugin had an unrecoverable error. Will restart this plugin.
  Pipeline_id:main
  Plugin: <LogStash::Inputs::File mode=>"read", path=>["D:/tmp/xmlTest/**/*.xml"], codec=><LogStash::Codecs::Plain charset=>"ISO-8859-1", id=>"6acfc357-46a7-4140-87ce-74573cc625f7", enable_metric=>true>, id=>"d796668ae17963896f277b7a7886da49184fe00a1003cf880d18db7c54bc5f03", type=>"fooBar", file_completed_action=>"log", sincedb_path=>"d:/tmp/sincedb_readMode", file_completed_log_path=>"d:/tmp/completedXmls.txt", enable_metric=>true, stat_interval=>1.0, discover_interval=>15, sincedb_write_interval=>15.0, start_position=>"end", delimiter=>"\n", close_older=>3600.0, sincedb_clean_after=>1209600.0, file_chunk_size=>32768, file_chunk_count=>140737488355327, file_sort_by=>"last_modified", file_sort_direction=>"asc">
  Error: undefined method `path' for nil:NilClass
  Exception: NoMethodError
  Stack: D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/sincedb_value.rb:71:in `reading_completed'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/sincedb_collection.rb:165:in `reading_completed'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/read_mode/handlers/read_file.rb:22:in `handle_specifically'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/read_mode/handlers/base.rb:26:in `handle'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/read_mode/processor.rb:35:in `read_file'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/read_mode/processor.rb:102:in `block in process_active'
org/jruby/RubyArray.java:1734:in `each'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/read_mode/processor.rb:86:in `process_active'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/read_mode/processor.rb:45:in `process_all_states'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/watch.rb:67:in `iterate_on_state'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/watch.rb:45:in `subscribe'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/filewatch/observing_read.rb:12:in `subscribe'
D:/progs/logstash/logstash-6.4.0/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.5/lib/logstash/inputs/file.rb:339:in `run'
D:/progs/logstash/logstash-6.4.0/logstash-core/lib/logstash/pipeline.rb:408:in `inputworker'
D:/progs/logstash/logstash-6.4.0/logstash-core/lib/logstash/pipeline.rb:402:in `block in start_input'

Any idea why this is not working?
Bye,
Markus

I read through the docs of the file input again and discovered that the path argument is of type array. So I modified my Config to this:

input {
	stdin {}
	
	file {
		path => ["D:/tmp/xmlTest/**/*.xml"]
		type => "fooBar"
		mode => "read"

		codec => plain {
			charset => "ISO-8859-1"
		}
		
		file_completed_action => "log"
		file_completed_log_path => "d:/tmp/completedXmls.txt"
		
		sincedb_path => "d:/tmp/sincedb_readMode"
	}
}
output {
	stdout {
		codec => rubydebug
	}
}

But it is still producing the same error message...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.