# Rolling log files based on both size and date

**URL:** https://discuss.elastic.co/t/rolling-log-files-based-on-both-size-and-date/97588
**Category:** Elasticsearch
**Created:** [August 18, 2017, 1:11pm UTC](https://discuss.elastic.co/t/rolling-log-files-based-on-both-size-and-date/97588 "2017-08-18T13:11:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![prashant.bajpai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant.bajpai/32/16844_2.png) [@prashant.bajpai](https://discuss.elastic.co/u/prashant.bajpai)
#### Post date: [August 18, 2017, 1:11pm UTC](https://discuss.elastic.co/t/rolling-log-files-based-on-both-size-and-date/97588/1 "2017-08-18T13:11:59Z")

</div>

Hi All

Is there any way to roll log files based on both size and date ?  
I googled it a lot but still didn't find any working solution for me.  
My requirement is as below:

```
application.log.2017-08-17.1.gz
application.log.2017-08-17.2.gz
application.log.2017-08-17.gz
application.log.2017-08-18.1.gz
application.log.2017-08-18.2.gz
application.log --------- Current log file ( Assume current date : 2017-08-18)

```

I have tried below configuration in logging.yml but It didn't worked.

```
file:
    type: rollingFile
    rollingPolicy: timeBased
    file: ${path.logs}/application.log
    rollingPolicy.FileNamePattern: ${path.logs}/application.log.%d{yyyy-MM-dd}.%i.gz
    triggeringPolicy: sizeBased
    triggeringPolicy.MaxFileSize: 2KB
    append: true
    layout:
      type: pattern
      conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

```

There is only application.log file is created and its size is keeps on increasing.

I am using ES - 2.3.2.

Can somebody help ? Its really urgent.

---

<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: [September 15, 2017, 1:24pm UTC](https://discuss.elastic.co/t/rolling-log-files-based-on-both-size-and-date/97588/2 "2017-09-15T13:24:09Z")

</div>

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