You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by prabhu Mahendran <pr...@gmail.com> on 2017/07/17 09:28:40 UTC
MaxHistoryNot Worked in logback-1.2.3?
I have tried below code to write logs based on SizeAndTimeBasedRollingPolicy
.
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?
Re: MaxHistoryNot Worked in logback-1.2.3?
Posted by prabhu Mahendran <pr...@gmail.com>.
Hi Aldrin,
Thanks for your response.
i wants to keep only 5 files each file should having size 100KB. If total
size of the files reaches 500KB then it will delete oldest file and then
write new file.
I have tried SizeAndTimeBasedPolicy then it couldn't preferable for me to
use with respect to my requirement.
According to that need which rolling policy would you recommend me to use
in NiFi?
Thanks,
Mahendran
Re: MaxHistoryNot Worked in logback-1.2.3?
Posted by Aldrin Piri <al...@gmail.com>.
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 <pr...@gmail.com>
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?
>