# How do I tell logstash-forwarder to finish processing a log before rotation?

**URL:** <https://discuss.elastic.co/t/how-do-i-tell-logstash-forwarder-to-finish-processing-a-log-before-rotation/27382>\
**Category:** Logstash\
**Created:** [August 14, 2015, 9:38am UTC](https://discuss.elastic.co/t/how-do-i-tell-logstash-forwarder-to-finish-processing-a-log-before-rotation/27382 "2015-08-14T09:38:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chmd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chmd/32/4194_2.png) [@chmd](https://discuss.elastic.co/u/chmd)\
**Post date:** [August 14, 2015, 9:38am UTC](https://discuss.elastic.co/t/how-do-i-tell-logstash-forwarder-to-finish-processing-a-log-before-rotation/27382/1 "2015-08-14T09:38:47Z")

</div>

Hi,

I am using logstash-forwarder to forward the content of a file. This file grows fast, and I need to rotate it often. To give you an idea, I trigger logrotate every 5 minutes. The condition for the rotation to actually happen is that the file must be bigger than 100M, and this condition is almost always satisfied.

I don't want to lose messages. I have a prerotate hook that stops the process generating the log and a postrotate hook that starts it again.

I also want to make sure that logstash-forwarder has time to process the log before the rotation. How can I guarantee that?

Cheers,  
Christophe-Marie

---

<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:31am UTC](https://discuss.elastic.co/t/how-do-i-tell-logstash-forwarder-to-finish-processing-a-log-before-rotation/27382/2 "2017-07-06T05:31:58Z")

</div>


