# Logstash / Filewatch double initialization

**URL:** <https://discuss.elastic.co/t/logstash-filewatch-double-initialization/41647>\
**Category:** Logstash\
**Created:** [February 12, 2016, 5:15pm UTC](https://discuss.elastic.co/t/logstash-filewatch-double-initialization/41647 "2016-02-12T17:15:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdanziger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bdanziger/32/7762_2.png) [@bdanziger](https://discuss.elastic.co/u/bdanziger)\
**Post date:** [February 12, 2016, 5:15pm UTC](https://discuss.elastic.co/t/logstash-filewatch-double-initialization/41647/1 "2016-02-12T17:15:22Z")

</div>

I contributed to filewatch in the past, and was retesting Logstash 2.2.0 to see that the bug fixes were really working properly since they were integrated differently than I originally intended.

So, the question.  
I am using input files (filewatch) and noticed that tail\_base.rb Initialize method is being called 2 times with just 1 file in my config. The first time through it passes opts (arguments from tail\_config) that are empty. The 2nd time through they are correct. The issue is, when they are empty, tail\_base.rb raises an exception because there is no sincedb\_path config parameter.

The way around this is to setup a SINCEDB\_PATH environment variable, but this is just a workaround.

I am not yet able to understand why this code is being called twice and the first time through there are no configuration parameters. I am not yet saying this is a bug. Maybe it is something I am not understanding. If anyone could shed some light, that would be very helpful.

If you want to know the stack traces of the two passes they are

first pass in tail\_base.rb initialize when only using one input file.

pipeline.rb 310 in start\_input  
pipeline.rb 316 in input\_worker  
file.rb 288 in run  
file.rb 282 in begin\_tailing  
tail.rb 14 new\_observing  
tail.rb 20 in initialize

2nd pass

pipeline.rb 310 in start\_input  
pipeline.rb 316 in input\_worker  
file.rb 288 in run  
file.rb 282 in begin\_tailing  
tail.rb 14 new\_observing  
rail.rb 14 tap  
tail.rb 15 in new\_observing

Thanks,

---

<div class="post-metadata">

**Author:** ![bdanziger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bdanziger/32/7762_2.png) [@bdanziger](https://discuss.elastic.co/u/bdanziger)\
**Post date:** [February 13, 2016, 6:39pm UTC](https://discuss.elastic.co/t/logstash-filewatch-double-initialization/41647/2 "2016-02-13T18:39:39Z")

</div>

Close this item. I have figured it out.

---

<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:11am UTC](https://discuss.elastic.co/t/logstash-filewatch-double-initialization/41647/3 "2017-07-06T05:11:40Z")

</div>


