Support Questions
Find answers, ask questions, and share your expertise

NiFi 1.13.2 logs config not working

NiFi 1.13.2 logs config not working

New Contributor

NiFi 1.13.2
OpenJDK 1.8.0_292 (64-bit)

 

 

<appender name="APP_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!--
              For daily rollover, use 'app_%d.log'.
              For hourly rollover, use 'app_%d{yyyy-MM-dd_HH}.log'.
              To GZIP rolled files, replace '.log' with '.log.gz'.
              To ZIP rolled files, replace '.log' with '.log.zip'.
            -->
            <fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app_%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
            <maxFileSize>100MB</maxFileSize>
            <!-- keep 30 log files worth of history -->
            <maxHistory>30</maxHistory>  
            <totalSizeCap>50GB</totalSizeCap>
            <!-- archive removal will be executed on appender start up -->
            <cleanHistoryOnStart>true</cleanHistoryOnStart>
        </rollingPolicy>
        <immediateFlush>true</immediateFlush>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
        </encoder>
    </appender>

 

 

From what I understand from the config, logs will have 30hours of history and 50GB overall size. But the logs we had and experience more than once already, was 200GB of logs. This causes the system to crash.

Please help how to properly configure nifi to limit the log size and I've tried to do it by myself with no luck.

 

Thank you!

1 REPLY 1

Re: NiFi 1.13.2 logs config not working

Master Guru

@Nickanor 

It would be interesting to see a verbose listing of your NiFi  logs directory once it has well exceeded 50 GB archived log files.

What you have configured will retain 30 hours of log data.  With each of those 30 hours you may have 1 or more incremental log files (each at 100 MB except for last one each hour).

On NiFi restart do you see that the following is cleaning up the archive directory of files older than 30 hours:

<cleanHistoryOnStart>true</cleanHistoryOnStart>

 
I would be inspecting the nifi-app.log to see if you encounter any exceptions around logback or if you see any OutOfMemory (OOM) or no more files (file limits) exceptions that may explain the behavior.

Hope this helps,
Matt