Rolling log files based on both size and date


(pBajpai) #1

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.


(system) #2

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