# Logstash stops without opening file to read

**URL:** <https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336>\
**Category:** Logstash\
**Created:** [November 23, 2015, 5:46pm UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336 "2015-11-23T17:46:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fares/32/45311_2.png) [@fares](https://discuss.elastic.co/u/fares)\
**Post date:** [November 23, 2015, 5:46pm UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/1 "2015-11-23T17:46:44Z")

</div>

Hi,

Here's my config file :

> input{file {  
> path =\> "/data/ttr.csv"  
> sincedb\_path =\> "/dev/null"  
> start\_position =\> "beginning"  
> }}  
> output{  
> stdout{ }  
> }

When i start logstash with debug mode:

> Reading config file {:file=\>"logstash/agent.rb", :level=\>:debug, :line=\>"318", :method=\>"local\_config"}  
> Compiled pipeline code:  
> inputs =   
> filters =   
> outputs =   
> periodic\_flushers =   
> shutdown\_flushers =

> ```
> input_file_1 = plugin("input", "file", LogStash::Util.hash_merge_many({ "path" => ("/data/ttr.csv") }, { "start_position" => ("beginning") }))
> inputs << @input_file_1
> output_stdout_2 = plugin("output", "stdout")
> outputs << @output_stdout_2
> 
> ```
> 
> def filter\_func(event)  
> events = [event]  
> logger.debug? && @logger.debug("filter received", :event =\> event.to\_hash)  
> events  
> end  
> def output\_func(event)  
> logger.debug? && @logger.debug("output received", :event =\> event.to\_hash)  
> output\_stdout\_2.handle(event)

> end {:level=\>:debug, :file=\>"logstash/pipeline.rb", :line=\>"37", :method=\>"initialize"}  
> Plugin not defined in namespace, checking for plugin file {:type=\>"input", :name=\>"file", :path=\>"logstash/inputs/file", :level=\>:debug, :file=\>"logstash/plugin.rb", :line=\>"71", :method=\>"lookup"}  
> Plugin not defined in namespace, checking for plugin file {:type=\>"codec", :name=\>"plain", :path=\>"logstash/codecs/plain", :level=\>:debug, :file=\>"logstash/plugin.rb", :line=\>"71", :method=\>"lookup"}  
> config LogStash::Codecs::Plain/@charset = "UTF-8" {:level=\>:debug, :file=\>"logstash/config  
> config LogStash::Inputs::File/@path = ["/data/ttr.csv"] {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> config LogStash::Inputs::File/@start\_position = "beginning" {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> config LogStash::Inputs::File/@add\_field = {} {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> config LogStash::Inputs::File/@delimiter = "\n" {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> Plugin not defined in namespace, checking for plugin file {:type=\>"output", :name=\>"stdout", :path=\>"logstash/outputs/stdout", :level=\>:debug, :file=\>"logstash/plugin.rb", :line=\>"71", :method=\>"lookup"}  
> Plugin not defined in namespace, checking for plugin file {:type=\>"codec", :name=\>"line", :path=\>"logstash/codecs/line"file=\>"logstash/plugin.rb", :line=\>"71", :method=\>"lookup"}  
> config LogStash::Codecs::Line/@charset = "UTF-8" {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> config LogStash::Outputs::Stdout/@codec = \<LogStash::Codecs::Line charset=\>"UTF-8"\> {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> config LogStash::Outputs::Stdout/@workers = 1 {:level=\>:debug, :file=\>"logstash/config/mixin.rb", :line=\>"128", :method=\>"config\_init"}  
> Default settings used: Filter workers: 4  
> Registering file input {:path=\>["/data/ttr.csv"], :level=\>:info, :file=\>"logstash/inputs/file.rb", :line=\>"128", :method=\>"register"}  
> No sincedb\_path set, generating one based on the file path {:sincedb\_path=\>"/root/.sincedb\_3e41defd8eea49698d0fc0c9c77f1600", :path=\>["/data/ttr.csv"], :level=\>:info, :file=\>"logstash/inputs/file.rb", :line=\>"171", :method=\>"register"}  
> Pipeline started {:level=\>:info, :file=\>"logstash/pipeline.rb", :line=\>"89", :method=\>"run"}  
> Logstash startup completed  
> \_sincedb\_open: /root/.sincedb\_3e41defd8eea49698d0fc0c9c77f1600: No such file or directory - /root/.sincedb\_3e41defd8eea49698d0fc0c9c77f1600 {:level=\>:debug, :file=\>"filewatch/tail.rb", :line=\>"215", :method=\>"\_sincedb\_open"}  
> \_discover\_file\_glob: /data/ttr.csv: glob is: ["/data/ttr.csv"] {:level=\>:debug, :file=\>"filewatch/watch.rb", :line=\>"132", :method=\>"\_discover\_file"}  
> \_discover\_file: /data/ttr.csv: new: /data/ttr.csv (exclude is ) {:level=\>:debug, :file=\>"filewatch/watch.rb", :line=\>"141", :method=\>"\_discover\_file"}  
> closing {:plugin=\>\<LogStash::Inputs::File path=\>["/data/ttr.csv"], start\_position=\>"beginning", codec=\>\<LogStash::Codecs::Plain charset=\>"UTF-8"\>, stat\_interval=\>1, discover\_interval=\>15, sincedb\_write\_interval=\>15, delimiter=\>"\n"\>, :level=\>:debug, :file=\>"logstash/plugin.rb", :line=\>"35", :method=\>"do\_close"}  
> closing {:plugin=\>\<LogStash::Outputs::Stdout codec=\>\<LogStash::Codecs::Line charset=\>"UTF-8"\>, workers=\>1\>, :level=\>:debug, :file=\>"logstash/plugin.rb", :line=\>"35", :method=\>"do\_close"}  
> Pipeline shutdown complete. {:level=\>:info, :file=\>"logstash/pipeline.rb", :line=\>"103", :method=\>"run"}  
> Logstash shutdown completed

It stops before even reading the file.  
I Don't understand why.

Any help please ?  
Thanks.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 24, 2015, 6:56am UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/2 "2015-11-24T06:56:57Z")

</div>

Try changing the input to `stdin {}` and then `cat /data/ttr.csv | logstash -f config.conf`.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 24, 2015, 7:01am UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/3 "2015-11-24T07:01:21Z")

</div>

> No sincedb\_path set, generating one based on the file path

This isn't consistent with the configuration you showed us. Make sure you're running with the intended configuration.

---

<div class="post-metadata">

**Author:** ![fares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fares/32/45311_2.png) [@fares](https://discuss.elastic.co/u/fares)\
**Post date:** [November 24, 2015, 9:46am UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/4 "2015-11-24T09:46:31Z")

</div>

Thanks for your reply, it works.

But I would like to do it with the file-plugin, the main purpose is to read different log files from a unique source, so the plugin would be useful fo types, charsets etc ..

I notice another issue, logstash stops every time I launch it after reading the file.  
`Logstash shutdown completed`  
This behaviour doesnt let me read new lines from files, how can I change this to keep logstash permanetly up and waiting for new events ?

---

<div class="post-metadata">

**Author:** ![fares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fares/32/45311_2.png) [@fares](https://discuss.elastic.co/u/fares)\
**Post date:** [November 24, 2015, 10:09am UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/5 "2015-11-24T10:09:02Z")

</div>

Thanks for your reply.

May be I've tried with the wrong config file.

I just have tried again to run it with debug mode and i have this line for since\_db.  
`_sincedb_open: reading from /data/sincedb {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"219", :method=>"_sincedb_open"}`

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 24, 2015, 12:22pm UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/6 "2015-11-24T12:22:45Z")

</div>

> But I would like to do it with the file-plugin, the main purpose is to read different log files from a unique source, so the plugin would be useful fo types, charsets etc ..

Of course, but during testing when you're probably reading the same file many times it's often more convenient to use the stdin input.

> I notice another issue, logstash stops every time I launch it after reading the file.

Yes, that's expected. When the stdin input reaches the end of the input stream it'll signal to Logstash to shut down.

> I just have tried again to run it with debug mode and i have this line for since\_db.

> ```
> _sincedb_open: reading from /data/sincedb {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"219", :method=>"_sincedb_open"}
> 
> ```

Yes? This indicates that you have `sincedb_path => "/data/sincedb"` in your configuration.

---

<div class="post-metadata">

**Author:** ![fares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fares/32/45311_2.png) [@fares](https://discuss.elastic.co/u/fares)\
**Post date:** [November 24, 2015, 1:12pm UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/7 "2015-11-24T13:12:45Z")

</div>

@warkolm  
@magnusbaeck  
I tried this workaround [https://github.com/elastic/logstash/issues/3127#issuecomment-101068714](https://github.com/elastic/logstash/issues/3127#issuecomment-101068714)  
And it seems to work.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 24, 2015, 1:22pm UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/8 "2015-11-24T13:22:40Z")

</div>

Um, okay? What made you try that workaround, given that it's a workaround for a problem that you don't seem to have?

---

<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:** [July 6, 2017, 5:21am UTC](https://discuss.elastic.co/t/logstash-stops-without-opening-file-to-read/35336/9 "2017-07-06T05:21:30Z")

</div>


