# Does filebeat work with logrotation using compress mode?

**URL:** https://discuss.elastic.co/t/does-filebeat-work-with-logrotation-using-compress-mode/81692
**Category:** Beats
**Tags:** filebeat
**Created:** [April 8, 2017, 10:51pm UTC](https://discuss.elastic.co/t/does-filebeat-work-with-logrotation-using-compress-mode/81692 "2017-04-08T22:51:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)
#### Post date: [April 8, 2017, 10:51pm UTC](https://discuss.elastic.co/t/does-filebeat-work-with-logrotation-using-compress-mode/81692/1 "2017-04-08T22:51:39Z")

</div>

Hello.

I am planning to use the filebeat to collect logs. All the logs will be rotated using _logrotate_ command for linux Reading the posts I understood that filebeat keeps track of data by _inode_.

However, if the logs are rotated using **compress** mode , I assume specifying the path in the prospectors as message\* is not a good idea.

```
filebeat.prospectors:
- input_type: log
  paths:
     - /var/log/messages*

```

Is there any specific combination of configuration options which I need to specify for my case?

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [April 10, 2017, 8:22am UTC](https://discuss.elastic.co/t/does-filebeat-work-with-logrotation-using-compress-mode/81692/2 "2017-04-10T08:22:07Z")

</div>

when compressing logs, you often append `.gz` to the file names. How many files to you keep as plaintext? You can either define all patterns or use `exclude_files` with `'\.gz$'` to filter out all compressed files.

---

<div class="post-metadata">

### Author: ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)
#### Post date: [April 11, 2017, 2:23am UTC](https://discuss.elastic.co/t/does-filebeat-work-with-logrotation-using-compress-mode/81692/3 "2017-04-11T02:23:25Z")

</div>

@steffens

Thank you for the reply.

I am considerting about up to 31 days of text files and rest with gz files.  
Looks like excluding gz extension will work out for me.

---

<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: [May 9, 2017, 2:33am UTC](https://discuss.elastic.co/t/does-filebeat-work-with-logrotation-using-compress-mode/81692/4 "2017-05-09T02:33:33Z")

</div>

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