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

**URL:** <https://discuss.elastic.co/t/error-undefined-method-path-for-nil-nilclass-from-file-input/148999>\
**Category:** Logstash\
**Created:** [September 18, 2018, 3:33pm UTC](https://discuss.elastic.co/t/error-undefined-method-path-for-nil-nilclass-from-file-input/148999 "2018-09-18T15:33:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![markus](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@markus](https://discuss.elastic.co/u/markus)\
**Post date:** [September 18, 2018, 3:33pm UTC](https://discuss.elastic.co/t/error-undefined-method-path-for-nil-nilclass-from-file-input/148999/1 "2018-09-18T15:33:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![markus](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@markus](https://discuss.elastic.co/u/markus)\
**Post date:** [September 19, 2018, 7:10am UTC](https://discuss.elastic.co/t/error-undefined-method-path-for-nil-nilclass-from-file-input/148999/2 "2018-09-19T07:10:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 17, 2018, 7:10am UTC](https://discuss.elastic.co/t/error-undefined-method-path-for-nil-nilclass-from-file-input/148999/3 "2018-10-17T07:10:27Z")

</div>

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