Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Nifi 1.2.0 on Windows 2012 Server is not rolling over its log files.

avatar
New Member

I have NiFi 1.2.0 installed on the Windows 2012 R2 server, it creates the standard logs files as under:

  • nifi-bootstrap.log
  • nifi-app.log
  • nifi-user.log

Issue is that these files are not rolling over daily or based on size. Can someone help? I have attached the logback.xml file.

Also, are the changes to this logback.xml dynamically implemented, or it requires NiFi to get into effect?

1 ACCEPTED SOLUTION

avatar
Rising Star

@AViradia

I suspect that Windows locking mechanism restricts the original file to be renamed(Check http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03222.html for details).

You can omit the file property in logback.xml, and then the active log file will be computed a new for each period based on the value of fileNamePattern. A working rollingpolicy for a NiFi node on Windows is as follows:

<appender name="APP_FILE"> 
<!-- <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app.log</file> --> 
<rollingPolicy> 
<!-- 
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> 
<timeBasedFileNamingAndTriggeringPolicy> 
<maxFileSize>100MB</maxFileSize> 
</timeBasedFileNamingAndTriggeringPolicy> 
<!-- keep 30 log files worth of history --> 
<maxHistory>30</maxHistory> 
</rollingPolicy> 

Ref: https://logback.qos.ch/manual/appenders.html

View solution in original post

3 REPLIES 3

avatar
Contributor

Hi Avi,

Please updated the logback.xml with below correction and restart nifi to reflect the changes.

your logback.xml

<fileNamePattern>
C:\NiFi\nifi-1.2.0\logs\nifi-app_%d{yyyy-MM-dd_HH}.%i.zip
</fileNamePattern>

But it should be:

<fileNamePattern>
C:\NiFi\nifi-1.2.0\logs\nifi-app_%d{yyyy-MM-dd_HH}.%i.log.zip
</fileNamePattern>

avatar
Rising Star

@AViradia

I suspect that Windows locking mechanism restricts the original file to be renamed(Check http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03222.html for details).

You can omit the file property in logback.xml, and then the active log file will be computed a new for each period based on the value of fileNamePattern. A working rollingpolicy for a NiFi node on Windows is as follows:

<appender name="APP_FILE"> 
<!-- <file>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app.log</file> --> 
<rollingPolicy> 
<!-- 
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> 
<timeBasedFileNamingAndTriggeringPolicy> 
<maxFileSize>100MB</maxFileSize> 
</timeBasedFileNamingAndTriggeringPolicy> 
<!-- keep 30 log files worth of history --> 
<maxHistory>30</maxHistory> 
</rollingPolicy> 

Ref: https://logback.qos.ch/manual/appenders.html

avatar
New Member

Thanks Shashank, logs are now rolling over on both time and size triggers. Awesome!