# Disable logrotation

**URL:** <https://discuss.elastic.co/t/disable-logrotation/83444>\
**Category:** Elasticsearch\
**Created:** [April 24, 2017, 5:50pm UTC](https://discuss.elastic.co/t/disable-logrotation/83444 "2017-04-24T17:50:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![animageofmine](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@animageofmine](https://discuss.elastic.co/u/animageofmine)\
**Post date:** [April 24, 2017, 5:50pm UTC](https://discuss.elastic.co/t/disable-logrotation/83444/1 "2017-04-24T17:50:06Z")

</div>

We have our internal infrastructure that takes care of log rotation and because ES has inbuilt log rotation by default, the glob pattern does not match ultimately canceling out any log rotation.

Is there a way to disable log rotation in ES via configuration? If so, can you please provide an example?

---

<div class="post-metadata">

**Author:** ![igormarqs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igormarqs/32/17678_2.png) [@igormarqs](https://discuss.elastic.co/u/igormarqs)\
**Post date:** [April 25, 2017, 7:52pm UTC](https://discuss.elastic.co/t/disable-logrotation/83444/2 "2017-04-25T19:52:06Z")

</div>

i found this topic. i hope this can help.

[https://discuss.elastic.co/t/log-file-retention-settings/33160/4?u=igormarqs](https://discuss.elastic.co/t/log-file-retention-settings/33160/4?u=igormarqs)

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 26, 2017, 2:36am UTC](https://discuss.elastic.co/t/disable-logrotation/83444/3 "2017-04-26T02:36:44Z")

</div>

What version of Elasticsearch?

---

<div class="post-metadata">

**Author:** ![animageofmine](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@animageofmine](https://discuss.elastic.co/u/animageofmine)\
**Post date:** [April 26, 2017, 5:15am UTC](https://discuss.elastic.co/t/disable-logrotation/83444/4 "2017-04-26T05:15:49Z")

</div>

We are on 5.1.

I read that for 5.3 and onwards, there is a way to rotate file with TimeBasedTriggeringPolicy, where filePattern contains date.

Anyway let me know if there is a way to disable the rotation (may be overwrite log4j2.properties with a blank file?)

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 26, 2017, 2:10pm UTC](https://discuss.elastic.co/t/disable-logrotation/83444/5 "2017-04-26T14:10:12Z")

</div>

I'll be upfront and say first that you are entering unsupported territory, and you are at risk of losing log messages if you switch to using an external rotation strategy. There's no guarantee that when the log file is externally manipulated Log4j transitions seamlessly and you don't lose log messages or have log messages partially written across two files. It doesn't matter if you use a rename/new strategy, or something like `copytruncate`.

If you insist on doing this, you need to change the appender in the default `log4j2.properties` configuration from the rolling file appender to a different appender like the file appender, and remove the size-based triggering policy. You'll need to consult the Log4j docs for the specific parameters for your use case.

---

<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 24, 2017, 2:18pm UTC](https://discuss.elastic.co/t/disable-logrotation/83444/6 "2017-05-24T14:18:39Z")

</div>

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