# Retain log files on demand

**URL:** <https://discuss.elastic.co/t/retain-log-files-on-demand/169269>\
**Category:** Elasticsearch\
**Created:** [February 20, 2019, 5:29pm UTC](https://discuss.elastic.co/t/retain-log-files-on-demand/169269 "2019-02-20T17:29:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolay\_Petrov](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nikolay\_Petrov](https://discuss.elastic.co/u/Nikolay_Petrov)\
**Post date:** [February 20, 2019, 5:29pm UTC](https://discuss.elastic.co/t/retain-log-files-on-demand/169269/1 "2019-02-20T17:29:20Z")

</div>

Hi,  
could you please help with this.  
I've tried many scenario, the current one is:

> ...  
> appender.rolling.type = RollingFile  
> appender.rolling.name = rolling  
> appender.rolling.fileName = ${sys:es.logs.base\_path}${sys:file.separator}${sys:es.logs.cluster\_name}.log  
> appender.rolling.layout.type = PatternLayout  
> appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n  
> appender.rolling.filePattern = ${sys:es.logs.base\_path}${sys:file.separator}${sys:es.logs.cluster\_name}-%d{yyyy-MM-dd}-%i.log.gz  
> appender.rolling.policies.type = Policies  
> appender.rolling.policies.time.type = TimeBasedTriggeringPolicy  
> appender.rolling.policies.time.interval = 1  
> appender.rolling.policies.time.modulate = true  
> appender.rolling.policies.size.type = SizeBasedTriggeringPolicy  
> appender.rolling.policies.size.size = 128MB  
> appender.rolling.strategy.type = DefaultRolloverStrategy  
> appender.rolling.strategy.fileIndex = nomax  
> appender.rolling.strategy.action.type = Delete  
> appender.rolling.strategy.action.basepath = ${sys:es.logs.base\_path}  
> appender.rolling.strategy.action.condition.type = IfFileName  
> appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster\_name}-\*  
> appender.rolling.strategy.action.condition.nested\_condition.type = IfAny  
> appender.rolling.strategy.action.condition.nested\_condition.exceeds = 128MB  
> appender.rolling.strategy.action.condition.nested\_condition.age = 1D  
> ...

,but not able to adjust elastic to retain it's own log on the fly, let say if 'cluster.log' reach out the limit described in log4j2.properties(128M) without restarting of the deamon or after 1day.

Is there any way to rotate the logs within elastic (not by logrotate) if log reach the limit 128M, but do not restart the elastic daemon?

---

<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 20, 2019, 5:29pm UTC](https://discuss.elastic.co/t/retain-log-files-on-demand/169269/2 "2019-03-20T17:29:21Z")

</div>

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