# Logrotate problems (I think)

**URL:** <https://discuss.elastic.co/t/logrotate-problems-i-think/76840>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [February 28, 2017, 5:23pm UTC](https://discuss.elastic.co/t/logrotate-problems-i-think/76840 "2017-02-28T17:23:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cylindric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cylindric/32/5660_2.png) [@Cylindric](https://discuss.elastic.co/u/Cylindric)\
**Post date:** [February 28, 2017, 5:23pm UTC](https://discuss.elastic.co/t/logrotate-problems-i-think/76840/1 "2017-02-28T17:23:03Z")

</div>

I have a fairly high-volume log file source (Varnish) that I'm trying to push into ES.

What I'm seeing, is FileBeat seems to start logging every hour, roughly on the hour, but only for a few minutes (seems to vary between 5 and 20 minutes). Then it goes mostly quiet until the next hour.

![](https://us1.discourse-cdn.com/elastic/original/2X/1/1b5470c7c2d84f367e23db86ee10853128d4bce0.png)

That felt to me like a log-rotation problem, but I thought Filebeat would keep an eye on a file that was rotated out the way?

I am rotating hourly:

```
/var/log/varnish/varnishncsa.log {
    rotate 4
    hourly
    missingok
    notifempty
    sharedscripts
    nocompress
    postrotate
        /bin/kill -HUP `cat /var/run/varnishlog.pid 2>/dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/varnishncsa.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

```

And my Prospector is setup like this:

filebeat.prospectors:

```
-
  type: log
  document_type: varnish
  close_inactive: 1m
  ignore_older: 15m
  paths:
    - /var/log/varnish/varnishncsa.log
  json.keys_under_root: true
  json.add_error_key: true
  json.overwrite_keys: true

output.elasticsearch:
  index: "varnish-%{+yyyy.MM.dd}"
  pipeline: varnish
  bulk_max_size: 2000
  template.enabled: false
  hosts: ["https://mycluster.eu-west-1.aws.found.io:9243"]
  username: ""
  password: ""
  compression_level: 9

```

I used `close_inactive:1m` because as per the docs, that is much longer than the gap between events, and `ignore_older:15m` because I don't want to rescan old files after a FileBeat restart.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 1, 2017, 8:38am UTC](https://discuss.elastic.co/t/logrotate-problems-i-think/76840/2 "2017-03-01T08:38:49Z")

</div>

It seems some of the logs are still shipped during the "silend" period. Did you have a look at the logs on what is happening there?

In general I would recommend to use `/var/log/varnish/varnishncsa.log*` or something similar which matches your rotation. So also on restart of filebeat and a file was rotated, it will still pick it up an finish reading.

---

<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:** [March 29, 2017, 8:38am UTC](https://discuss.elastic.co/t/logrotate-problems-i-think/76840/3 "2017-03-29T08:38:58Z")

</div>

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