# How To Make Logstash Read Entire File Every Time Which is from File Beat?

**URL:** <https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187>\
**Category:** Logstash\
**Created:** [June 8, 2018, 6:37pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187 "2018-06-08T18:37:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yenike\_Raghu\_Ram](https://avatars.discourse-cdn.com/v4/letter/y/7ea924/32.png) [@Yenike\_Raghu\_Ram](https://discuss.elastic.co/u/Yenike_Raghu_Ram)\
**Post date:** [June 8, 2018, 6:37pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/1 "2018-06-08T18:37:24Z")

</div>

input {  
beats {  
port =\> 5048  
}  
}

output {  
stdout { codec =\> rubydebug }  
file  
{  
codec =\> line {  
format =\> "%{[message]}"  
}  
path =\> "C:/Program Files/logstash-6.2.3/testPractice/LogsCollected/DebugLog09May2018/OneTwo.html}  
}

For first time OneTwo.html is read its fine , from second time when OneTwo.html changes  
Content is appended at bottom and that too not properly

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 8, 2018, 7:44pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/2 "2018-06-08T19:44:52Z")

</div>

Filebeat is designed to tail a log file and read new lines as they are appended to it. It is not designed to do what you are asking for.

---

<div class="post-metadata">

**Author:** ![Yenike\_Raghu\_Ram](https://avatars.discourse-cdn.com/v4/letter/y/7ea924/32.png) [@Yenike\_Raghu\_Ram](https://discuss.elastic.co/u/Yenike_Raghu_Ram)\
**Post date:** [June 9, 2018, 2:50am UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/3 "2018-06-09T02:50:28Z")

</div>

Yeah got it but in this case  
say like in original file I ve 2 lines  
a  
b

We've modified one line say 'a'  
now output file is like

a -- original data  
b  
a -- modified data  
b

I am expecting it to be like log file to have only two lines as with my original log file which has two lines , but with modified data in one of lines

a -- modified data  
b

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 9, 2018, 12:32pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/4 "2018-06-09T12:32:41Z")

</div>

> [@Yenike\_Raghu\_Ram](#):
>
> I am expecting it to be like log file to have only two lines as with my original log file which has two lines , but with modified data in one of lines

I cannot think of a way to do that with beats and logstash.

---

<div class="post-metadata">

**Author:** ![Yenike\_Raghu\_Ram](https://avatars.discourse-cdn.com/v4/letter/y/7ea924/32.png) [@Yenike\_Raghu\_Ram](https://discuss.elastic.co/u/Yenike_Raghu_Ram)\
**Post date:** [June 9, 2018, 3:22pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/5 "2018-06-09T15:22:30Z")

</div>

Is there a way to achieve this by having input as log stash in place of file beats (or) any other alternative?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 9, 2018, 3:26pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/6 "2018-06-09T15:26:20Z")

</div>

It sounds like you are trying to do remote file replication. logstash is not the right tool.

---

<div class="post-metadata">

**Author:** ![Yenike\_Raghu\_Ram](https://avatars.discourse-cdn.com/v4/letter/y/7ea924/32.png) [@Yenike\_Raghu\_Ram](https://discuss.elastic.co/u/Yenike_Raghu_Ram)\
**Post date:** [June 9, 2018, 5:14pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/7 "2018-06-09T17:14:16Z")

</div>

Can you please suggest any tool for doing remote file replication for MAC OSX (or) Windows OS, Thanks in advance

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 9, 2018, 5:34pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/8 "2018-06-09T17:34:52Z")

</div>

rsync.

---

<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 7, 2018, 5:46pm UTC](https://discuss.elastic.co/t/how-to-make-logstash-read-entire-file-every-time-which-is-from-file-beat/135187/9 "2018-07-07T17:46:46Z")

</div>

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