I think the comment in the config XML may be a bit misleading. Looking through the docs, it appears your configuration would keep 2 days of log files given your filename format leading to daily logs.
Your max size of 100kB will cause rollover, incrementing the value represented by %i. With this configuration, I would expect no more than two unique days of data, but an unbounded number of 100kB incremental logs for each of those two days. Doing some searching it seems to be a recurring problem with some bugginess [2], but seems like you may want to evaluate the totalSizeCap [3] to lock down the overall size. [1] https://logback.qos.ch/manual/appenders.html#tbrpMaxHistory [2] https://jira.qos.ch/browse/LOGBACK-747 [3] https://logback.qos.ch/manual/appenders.html#tbrpTotalSizeCap On Mon, Jul 17, 2017 at 5:28 AM, prabhu Mahendran <[email protected]> wrote: > I have tried below code to write logs based on SizeAndTimeBasedRollingPoli > cy. > > In that i can able to write files with respect to file size 100KB but not > able to maintain only 2 maxHistory files.It always write new file after > 100KB successfully written. > > Now i have using NiFI-1.3.0 which having logback version 1.2.3 for core > and classic jars. > > > <appender name="APP_FILE" class="ch.qos.logback.core. > rolling.RollingFileAppender"> > > <rollingPolicy class="ch.qos.logback.core.rolling. > SizeAndTimeBasedRollingPolicy"> > > <fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir} > /nifi-app_%d{yyyy-MM-dd}.%i.log</fileNamePattern> > > <maxFileSize>100 KB</maxFileSize> > > <!-- keep 30 log files worth of history --> > > <maxHistory>2</maxHistory> > > <historyAsFileCount>true</historyAsFileCount> > > > > </rollingPolicy> > > <encoder class="ch.qos.logback.classic. > encoder.PatternLayoutEncoder"> > > <pattern>%date %level [%thread] %logger{40} %msg%n</pattern> > > </encoder> > > </appender> > > > > I have faced like issue that may belongs to below task. > > https://jira.qos.ch/browse/LOGBACK-162 > > I have used NiFi-1.3.0 it only uses logback 1.2.3. > > In NiFi i have found one jira for upgrade logback. > > https://issues.apache.org/jira/browse/NIFI-3699 > > I think logback latest version is 1.2.3. Here it seems MaxHistory property > doesn't work. > > Am i missing anythink? > > Can anyone suggest me to solve this? >
