# Filebeat loses first lines when file rotated

**URL:** https://discuss.elastic.co/t/filebeat-loses-first-lines-when-file-rotated/327655
**Category:** Beats
**Tags:** filebeat
**Created:** [March 14, 2023, 12:28pm UTC](https://discuss.elastic.co/t/filebeat-loses-first-lines-when-file-rotated/327655 "2023-03-14T12:28:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Alexander\_A](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@Alexander\_A](https://discuss.elastic.co/u/Alexander_A)
#### Post date: [March 14, 2023, 12:28pm UTC](https://discuss.elastic.co/t/filebeat-loses-first-lines-when-file-rotated/327655/1 "2023-03-14T12:28:58Z")

</div>

We have discovered that filebeat loses first lines when file rotated.  
For example we use the following config to get auditbeat logs and when file rotated (auditbeat restarted) we see that first lines missing (written in first 10 seconds = scan\_frequency).

```auto
- type: filestream
  id: auditbeat-logs
  enabled: true
  paths:
    - /var/log/auditbeat/auditbeat-*.ndjson

```

Seems like filebeat uses [tail\_files](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#_tail_files_2) strategy and I'm wondering how we can change this behavior and force it to read new files from the beginning.

We have checked all options and read all topics and posts like [Log rotation results in lost or duplicate events](https://www.elastic.co/guide/en/beats/filebeat/current/file-log-rotation.html#file-log-rotation)

This issue make filebeat not reliable solution.

---

<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: [April 11, 2023, 2:29pm UTC](https://discuss.elastic.co/t/filebeat-loses-first-lines-when-file-rotated/327655/2 "2023-04-11T14:29:41Z")

</div>

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