Apache NiFi uses logback library to handle its logging. There is a file logback.xml present in the conf directory of NiFi, which is used to configure the logging in NiFi. The logs are generated in logs folder of NiFi and the log files are as described below.

nifi-app.log

This is the main log file of nifi, which logs all the activities of apache NiFi application ranging from NAR files loading to the run time errors or bulletins encountered by NiFi components. Below is the default appender in logback.xml file for nifi-app.log file.

  1. <appender name=”APPFILE”
  2. class=”ch.qos.logback.core.rolling.RollingFileAppender”>
  3. <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app.log</file>
  4. <rollingPolicy
  5. class=”ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy”>
  6. <fileNamePattern>
  7. ${org.apache.nifi.bootstrap.config.log.dir}/
  8. nifi-app%d{yyyy-MM-dd_HH}.%i.log
  9. </fileNamePattern>
  10. <maxFileSize>100MB</maxFileSize>
  11. <maxHistory>30</maxHistory>
  12. </rollingPolicy>
  13. <immediateFlush>true</immediateFlush>
  14. <encoder class=”ch.qos.logback.classic.encoder.PatternLayoutEncoder”>
  15. <pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
  16. </encoder>
  17. </appender>

The appender name is APP_FILE, and the class is RollingFileAppender, which means logger is using rollback policy. By default, the max file size is 100 MB and can be changed to the required size. The maximum retention for APP_FILE is 30 log files and can be changed as per the user requirement.

nifi-user.log

This log contains the user events like web security, web api config, user authorization, etc. Below is the appender for nifi-user.log in logback.xml file.

  1. <appender name="USER_FILE"
  2. class="ch.qos.logback.core.rolling.RollingFileAppender">
  3. <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-user.log</file>
  4. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  5. <fileNamePattern>
  6. ${org.apache.nifi.bootstrap.config.log.dir}/
  7. nifi-user_%d.log
  8. </fileNamePattern>
  9. <maxHistory>30</maxHistory>
  10. </rollingPolicy>
  11. <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  12. <pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
  13. </encoder>
  14. </appender>

The appender name is USER_FILE. It follows the rollover policy. The maximum retention period for USER_FILE is 30 log files. Below is the default loggers for USER_FILE appender present in nifi-user.log.

  1. <logger name="org.apache.nifi.web.security" level="INFO" additivity="false">
  2. <appender-ref ref="USER_FILE"/>
  3. </logger>
  4. <logger name="org.apache.nifi.web.api.config" level="INFO" additivity="false">
  5. <appender-ref ref="USER_FILE"/>
  6. </logger>
  7. <logger name="org.apache.nifi.authorization" level="INFO" additivity="false">
  8. <appender-ref ref="USER_FILE"/>
  9. </logger>
  10. <logger name="org.apache.nifi.cluster.authorization" level="INFO" additivity="false">
  11. <appender-ref ref="USER_FILE"/>
  12. </logger>
  13. <logger name="org.apache.nifi.web.filter.RequestLogger" level="INFO" additivity="false">
  14. <appender-ref ref="USER_FILE"/>
  15. </logger>

nifi-bootstrap.log

This log contains the bootstrap logs, apache NiFi’s standard output (all system.out written in the code mainly for debugging), and standard error (all system.err written in the code). Below is the default appender for the nifi-bootstrap.log in logback.log.

  1. <appender name="BOOTSTRAP_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  2. <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap.log</file>
  3. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  4. <fileNamePattern>
  5. ${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap_%d.log
  6. </fileNamePattern>
  7. <maxHistory>5</maxHistory>
  8. </rollingPolicy>
  9. <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  10. <pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
  11. </encoder>
  12. </appender>

nifi-bootstrap.log file,s appender name is BOOTSTRAP_FILE, which also follows rollback policy. The maximum retention for BOOTSTRAP_FILE appender is 5 log files. Below is the default loggers for nifi-bootstrap.log file.

  1. <logger name="org.apache.nifi.bootstrap" level="INFO" additivity="false">
  2. <appender-ref ref="BOOTSTRAP_FILE" />
  3. </logger>
  4. <logger name="org.apache.nifi.bootstrap.Command" level="INFO" additivity="false">
  5. <appender-ref ref="CONSOLE" />
  6. <appender-ref ref="BOOTSTRAP_FILE" />
  7. </logger>
  8. <logger name="org.apache.nifi.StdOut" level="INFO" additivity="false">
  9. <appender-ref ref="BOOTSTRAP_FILE" />
  10. </logger>
  11. <logger name="org.apache.nifi.StdErr" level="ERROR" additivity="false">
  12. <appender-ref ref="BOOTSTRAP_FILE" />
  13. </logger>