This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 5b60b2b8ec9 NIFI-16572 Added support for per Process Group logging in 
MiNiFi Java (#11912)
5b60b2b8ec9 is described below

commit 5b60b2b8ec9e63f0fbc9fdce860dec26faa4d688
Author: Vincenzo Lombardo <[email protected]>
AuthorDate: Sun Nov 22 00:24:33 2026 +0100

    NIFI-16572 Added support for per Process Group logging in MiNiFi Java 
(#11912)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
    Signed-off-by: David Handermann <[email protected]>
---
 minifi/minifi-assembly/pom.xml                     |  5 ++
 .../main/assembly/dependencies-windows-service.xml |  1 +
 .../src/main/assembly/dependencies.xml             |  1 +
 .../src/main/markdown/System_Admin_Guide.md        | 54 ++++++++++++++++++++++
 4 files changed, 61 insertions(+)

diff --git a/minifi/minifi-assembly/pom.xml b/minifi/minifi-assembly/pom.xml
index fd66dc4da94..dac2deafaae 100644
--- a/minifi/minifi-assembly/pom.xml
+++ b/minifi/minifi-assembly/pom.xml
@@ -184,6 +184,11 @@ limitations under the License.
             <artifactId>nifi-framework-api</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-per-process-group-logging</artifactId>
+            <scope>compile</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-jetty-nar</artifactId>
diff --git 
a/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml 
b/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml
index fcfe705a84a..3311425e2ca 100644
--- a/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml
+++ b/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml
@@ -44,6 +44,7 @@
                 <include>org.apache.nifi:nifi-framework-api</include>
                 <include>org.apache.nifi:nifi-python-framework-api</include>
                 <include>org.apache.nifi:nifi-nar-utils</include>
+                
<include>org.apache.nifi:nifi-per-process-group-logging</include>
                 <include>org.apache.nifi:nifi-properties</include>
                 <include>org.apache.nifi:nifi-property-utils</include>
                 <include>org.apache.nifi:nifi-runtime</include>
diff --git a/minifi/minifi-assembly/src/main/assembly/dependencies.xml 
b/minifi/minifi-assembly/src/main/assembly/dependencies.xml
index 9b9b67464e5..da14e2c6bf7 100644
--- a/minifi/minifi-assembly/src/main/assembly/dependencies.xml
+++ b/minifi/minifi-assembly/src/main/assembly/dependencies.xml
@@ -45,6 +45,7 @@
                 <include>org.apache.nifi:nifi-framework-api</include>
                 <include>org.apache.nifi:nifi-python-framework-api</include>
                 <include>org.apache.nifi:nifi-nar-utils</include>
+                
<include>org.apache.nifi:nifi-per-process-group-logging</include>
                 <include>org.apache.nifi:nifi-properties</include>
                 <include>org.apache.nifi:nifi-property-utils</include>
                 <include>org.apache.nifi:nifi-runtime</include>
diff --git a/minifi/minifi-docs/src/main/markdown/System_Admin_Guide.md 
b/minifi/minifi-docs/src/main/markdown/System_Admin_Guide.md
index 2ebfee7d861..ecd87958e9f 100644
--- a/minifi/minifi-docs/src/main/markdown/System_Admin_Guide.md
+++ b/minifi/minifi-docs/src/main/markdown/System_Admin_Guide.md
@@ -42,6 +42,7 @@ This documentation is for MiNiFi ${project.version}.
     + [Instance](#instance)
     + [System Diagnostics](#system-diagnostics)
     + [Example Query](#example-query)
+- [Per Process Group Logging](#per-process-group-logging)
 - [Config File](#config-file)
   * [Versioning](#versioning)
     + [Version 1 -> Version 2 Changes](#version-1-version-2-changes)
@@ -390,6 +391,59 @@ Bootstrap Config File: 
/Users/user/projects/nifi-minifi/minifi-assembly/target/m
 {"controllerServiceStatusList":null,"processorStatusList":[{"name":"Connection 
Diagnostics","processorHealth":{"runStatus":"Running","hasBulletins":false,"validationErrorList":[]},"processorStats":null,"bulletinList":null},{"name":"UpdateAttribute","processorHealth":{"runStatus":"Running","hasBulletins":false,"validationErrorList":[]},"processorStats":null,"bulletinList":null},{"name":"Processor
 
Diagnostics","processorHealth":{"runStatus":"Running","hasBulletins":false,"validationErrorLi
 [...]
 ```
 
+# <a id="per-process-group-logging" href="#per-process-group-logging">Per 
Process Group Logging</a>
+
+MiNiFi includes the `nifi-per-process-group-logging` library, which allows the 
log messages of the components in a Process Group to be written to a dedicated 
log file in addition to *minifi-app.log*. The dedicated file has its own 
rolling policy, so the messages of a single Process Group can be retained for a 
longer period without changing the retention of the main application log.
+
+This feature is disabled by default. Enabling it requires two steps:
+
+1. Set the `logFileSuffix` property of the Process Group in the flow 
definition. The log messages of all components in that Process Group, including 
nested Process Groups that do not define their own suffix, are written to 
*minifi-app-&lt;suffix&gt;.log*.
+2. Add a `SiftingAppender` using the 
`org.apache.nifi.logging.NifiDiscriminator` to *logback.xml* and reference it 
from the root logger. The `org.apache.nifi.logging.LogFileSuffixFilter` denies 
events without a Log File Suffix, so that only the log messages of Process 
Groups with a configured suffix are written to dedicated files.
+
+Example Process Group definition in *flow.json.raw*:
+
+```
+"processGroups": [
+  {
+    "identifier": "...",
+    "name": "Ingest",
+    "logFileSuffix": "ingest",
+    ...
+  }
+]
+```
+
+Example `logback.xml` configuration, writing to *logs/minifi-app-ingest.log* 
for the Process Group above:
+
+```
+<appender name="DEDICATED_LOGGING" 
class="ch.qos.logback.classic.sift.SiftingAppender">
+    <!-- Denies events without a Log File Suffix before they reach the 
discriminator -->
+    <filter class="org.apache.nifi.logging.LogFileSuffixFilter"/>
+    <discriminator class="org.apache.nifi.logging.NifiDiscriminator"/>
+    <sift>
+        <appender name="APP-${logFileSuffix}_FILE" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
+            
<file>${org.apache.nifi.minifi.bootstrap.config.log.dir}/${org.apache.nifi.minifi.bootstrap.config.log.app.file.name}-${logFileSuffix}.${org.apache.nifi.minifi.bootstrap.config.log.app.file.extension}</file>
+            <rollingPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+                
<fileNamePattern>${org.apache.nifi.minifi.bootstrap.config.log.dir}/${org.apache.nifi.minifi.bootstrap.config.log.app.file.name}-${logFileSuffix}_%d{yyyy-MM-dd_HH}.%i.${org.apache.nifi.minifi.bootstrap.config.log.app.file.extension}.gz</fileNamePattern>
+                <maxFileSize>10MB</maxFileSize>
+                <maxHistory>10</maxHistory>
+                <totalSizeCap>100MB</totalSizeCap>
+                <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>
+    </sift>
+</appender>
+
+<root level="INFO">
+    <appender-ref ref="APP_FILE"/>
+    <appender-ref ref="DEDICATED_LOGGING"/>
+</root>
+```
+
 # <a id="config-file" href="#config-file">Config File</a>
 
 The *flow.json.raw* in the `conf` directory is the main configuration file for 
controlling how MiNiFi runs.

Reply via email to