# Retention of audit logs

**URL:** <https://discuss.elastic.co/t/retention-of-audit-logs/219062>\
**Category:** Elasticsearch\
**Created:** [February 12, 2020, 6:42pm UTC](https://discuss.elastic.co/t/retention-of-audit-logs/219062 "2020-02-12T18:42:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![szemlyanoy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/szemlyanoy/32/22173_2.png) [@szemlyanoy](https://discuss.elastic.co/u/szemlyanoy)\
**Post date:** [February 12, 2020, 6:42pm UTC](https://discuss.elastic.co/t/retention-of-audit-logs/219062/1 "2020-02-12T18:42:22Z")

</div>

Hi,

The goal is to archive audit logs on daily basis and recycle archives older than n days.  
So far I haven't found correct property for audit\_rolling appender to get this working.

This is what I have

```
appender.audit_rolling.type = RollingFile
appender.audit_rolling.name = audit_rolling
appender.audit_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_access.log
appender.audit_rolling.layout.type = PatternLayout
appender.audit_rolling.layout.pattern = [%d{ISO8601}] %m%n
appender.audit_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_access-%d{yyyy-MM-dd-HH-mm}-%i.log.gz
appender.audit_rolling.policies.type = Policies
appender.audit_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.audit_rolling.policies.time.interval = 1
appender.audit_rolling.policies.time.modulate = true
appender.audit_rolling.strategy.action.condition.age = 10D

```

The last string seems is not applicable and prevents ES from starting.  
Please advice the correct way to rotate archived audit logs using log4j2.

ES version - 6.8.0

Thanks ahead,  
Sergii

---

<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 11, 2020, 6:42pm UTC](https://discuss.elastic.co/t/retention-of-audit-logs/219062/2 "2020-03-11T18:42:28Z")

</div>

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