How To Make File Input Read Entire File Every Time?

Hello everyone. I'm now learning to use logstash. And I want to practice a little on the "file" plugin in the input stage. However as the tutorial says, it will ignore the shipped content in an old file that had already been read and only catch the new appended lines. When logstash finds that the file has been read before, the "start_position" property in the "file" plugin goes no effect. How can I disable this feature and enable it later on?
Thanks a lot :smile:

You can set the following two parameters in your file input:

sincedb_path => "/dev/null"
start_position => "beginning"

The first sets the sincedb_path file to /dev/null, which means that logstash won't be able to save the place it was up to in the file between runs. The second sets the start_postion to the beginning of the file, so it will always read from the start of the file.

2 Likes

Thanks a lot! It's very helpful! :grinning:

If you're just testing/learning, using the stdin input along with cat file | logstash.... is easier :slight_smile:

yeah~It's really an easy way :grin: