fgerlits commented on code in PR #1713:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1713#discussion_r1448676610


##########
CONFIGURE.md:
##########
@@ -287,6 +341,62 @@ Another option to define a state storage is to use the 
following properties in t
     nifi.state.storage.local.auto.persistence.interval=0 sec
 
 
+### Configuring Repositories
+
+Apache MiNiFi C++ uses three repositories similarily to Apache NiFi:

Review Comment:
   typo:
   ```suggestion
   Apache MiNiFi C++ uses three repositories similarly to Apache NiFi:
   ```



##########
CONFIGURE.md:
##########
@@ -287,6 +341,62 @@ Another option to define a state storage is to use the 
following properties in t
     nifi.state.storage.local.auto.persistence.interval=0 sec
 
 
+### Configuring Repositories
+
+Apache MiNiFi C++ uses three repositories similarily to Apache NiFi:
+- The Flow File Repository holds the metadata (like flow file attributes) of 
the flow Files.
+- The Content Repository holds the content of the flow files.
+- The Provenance Repository holds the history of the flow files.
+
+The underlying implementation to use for these repositories can be configured 
in the minifi.properties file.
+
+The Flow File Repository can be configured with the 
`nifi.flowfile.repository.class.name` property. If not specified, it uses the 
`FlowFileRepository` class by default, which stores the flow file metadata in a 
RocksDB database. Alternatively it can be configured to use a 
`VolatileFlowFileRepository` that keeps the state in memory and flushes upon 
restart, or the `NoOpRepository` for not keeping any state.

Review Comment:
   I think "so the state gets lost" would be clearer than "and flushes"  
("flushes" suggests writing it out somewhere)



##########
CONFIGURE.md:
##########
@@ -78,8 +132,8 @@ MiNiFi supports YAML and JSON configuration formats. The 
desired configuration f
 
 ### Scheduling strategies
 Currently Apache NiFi MiNiFi C++ supports TIMER_DRIVEN, EVENT_DRIVEN, and 
CRON_DRIVEN. TIMER_DRIVEN uses periods to execute your processor(s) at given 
intervals.
-The EVENT_DRIVEN strategy awaits for data be available or some other 
notification mechanism to trigger execution. CRON_DRIVEN executes at the 
desired intervals
-based on the CRON periods. Apache NiFi MiNiFi C++ supports standard CRON 
expressions without intervals ( */5 * * * * ).
+The EVENT_DRIVEN strategy awaits for data be available or some other 
notification mechanism to trigger execution. EVENT_DRIVEN is the recommended 
strategy for non-source processors.
+CRON_DRIVEN executes at the desired intervals based on the CRON periods. 
Apache NiFi MiNiFi C++ supports standard CRON expressions without intervals ( 
*/5 * * * * ).

Review Comment:
   What does "without intervals" refer to?  I would guess it means "no ranges", 
but [the Cron unit 
tests](https://github.com/apache/nifi-minifi-cpp/blob/main/libminifi/test/unit/CronTests.cpp)
 show support for `"0 0-5 14 * * ?"`, `"0 15 10 ? * MON-FRI"` and `"0 15 10 ? * 
6L 2002-2005"`.  Maybe this limitation is out of date?



##########
CONFIGURE.md:
##########
@@ -287,6 +341,62 @@ Another option to define a state storage is to use the 
following properties in t
     nifi.state.storage.local.auto.persistence.interval=0 sec
 
 
+### Configuring Repositories
+
+Apache MiNiFi C++ uses three repositories similarily to Apache NiFi:
+- The Flow File Repository holds the metadata (like flow file attributes) of 
the flow Files.
+- The Content Repository holds the content of the flow files.
+- The Provenance Repository holds the history of the flow files.
+
+The underlying implementation to use for these repositories can be configured 
in the minifi.properties file.
+
+The Flow File Repository can be configured with the 
`nifi.flowfile.repository.class.name` property. If not specified, it uses the 
`FlowFileRepository` class by default, which stores the flow file metadata in a 
RocksDB database. Alternatively it can be configured to use a 
`VolatileFlowFileRepository` that keeps the state in memory and flushes upon 
restart, or the `NoOpRepository` for not keeping any state.
+
+    # in minifi.properties
+    nifi.flowfile.repository.class.name=VolatileFlowFileRepository
+
+The Content Repository can be configured with the 
`nifi.content.repository.class.name` property. If not specified, it uses the 
`DatabaseContentRepository` class by default, which persists the content in a 
RocksDB database. `DatabaseContentRepository` is also the default value 
specified in the minifi.properties file. Alternatively it can be configured to 
use a `VolatileContentRepository` that keeps the state in memory and flushes 
upon restart, or the `FileSystemRepository` to keep the state in regular files.
+
+**NOTE:** RocksDB database has a limit of 4GB for the size of a database 
object. Due to this if you are expecting to process larger flow files than 4GB 
you should use the `FileSystemRepository`. The downside of using 
`FileSystemRepository` is that it does not have the transactional guarantees of 
the RocksDB repository implementation.

Review Comment:
   minor, but I think "expect" would sound better:
   ```suggestion
   **NOTE:** RocksDB database has a limit of 4GB for the size of a database 
object. Due to this if you expect to process larger flow files than 4GB you 
should use the `FileSystemRepository`. The downside of using 
`FileSystemRepository` is that it does not have the transactional guarantees of 
the RocksDB repository implementation.
   ```



##########
CONFIGURE.md:
##########
@@ -287,6 +341,62 @@ Another option to define a state storage is to use the 
following properties in t
     nifi.state.storage.local.auto.persistence.interval=0 sec
 
 
+### Configuring Repositories
+
+Apache MiNiFi C++ uses three repositories similarily to Apache NiFi:
+- The Flow File Repository holds the metadata (like flow file attributes) of 
the flow Files.

Review Comment:
   the capitalization looks weird:
   ```suggestion
   - The Flow File Repository holds the metadata (like flow file attributes) of 
the flow files.
   ```



##########
CONFIGURE.md:
##########
@@ -287,6 +341,62 @@ Another option to define a state storage is to use the 
following properties in t
     nifi.state.storage.local.auto.persistence.interval=0 sec
 
 
+### Configuring Repositories
+
+Apache MiNiFi C++ uses three repositories similarily to Apache NiFi:
+- The Flow File Repository holds the metadata (like flow file attributes) of 
the flow Files.
+- The Content Repository holds the content of the flow files.
+- The Provenance Repository holds the history of the flow files.
+
+The underlying implementation to use for these repositories can be configured 
in the minifi.properties file.
+
+The Flow File Repository can be configured with the 
`nifi.flowfile.repository.class.name` property. If not specified, it uses the 
`FlowFileRepository` class by default, which stores the flow file metadata in a 
RocksDB database. Alternatively it can be configured to use a 
`VolatileFlowFileRepository` that keeps the state in memory and flushes upon 
restart, or the `NoOpRepository` for not keeping any state.
+
+    # in minifi.properties
+    nifi.flowfile.repository.class.name=VolatileFlowFileRepository
+
+The Content Repository can be configured with the 
`nifi.content.repository.class.name` property. If not specified, it uses the 
`DatabaseContentRepository` class by default, which persists the content in a 
RocksDB database. `DatabaseContentRepository` is also the default value 
specified in the minifi.properties file. Alternatively it can be configured to 
use a `VolatileContentRepository` that keeps the state in memory and flushes 
upon restart, or the `FileSystemRepository` to keep the state in regular files.
+
+**NOTE:** RocksDB database has a limit of 4GB for the size of a database 
object. Due to this if you are expecting to process larger flow files than 4GB 
you should use the `FileSystemRepository`. The downside of using 
`FileSystemRepository` is that it does not have the transactional guarantees of 
the RocksDB repository implementation.
+
+    # in minifi.properties
+    nifi.content.repository.class.name=FileSystemRepository
+
+The Provenance Repository can be configured with the 
`nifi.provenance.repository.class.name` property. If not specified, it uses the 
`ProvenanceRepository` class by default, which persists the provenance events 
in a RocksDB database. Alternatively it can be configured to use a 
`VolatileProvenanceRepository` that keeps the state in memory and flushes upon 
restart, or the `NoOpRepository` to not keep track of the provenance events. By 
default we do not keep track of the provenance data, so `NoOpRepository` is the 
value specified in the default minifi.properties file.
+
+    # in minifi.properties
+    nifi.flowfile.repository.class.name=NoOpRepository
+
+
+### Configuring Volatile Repositories
+As stated before each of the repositories can be configured to be volatile 
(state kept in memory and flushed upon restart) or persistent. Volatile 
repositories have some additional options, that can be specified in the 
following ways:
+
+    # in minifi.properties
+    # For Volatile Repositories:
+    nifi.flowfile.repository.class.name=VolatileFlowFileRepository
+    nifi.provenance.repository.class.name=VolatileProvenanceRepository
+    nifi.content.repository.class.name=VolatileContentRepository
+
+    # configuration options
+    # maximum number of entries to keep in memory
+    nifi.volatile.repository.options.flowfile.max.count=10000
+    # maximum number of bytes to keep in memory, also limited by option above
+    nifi.volatile.repository.options.flowfile.max.bytes=1M
+
+    # maximum number of entries to keep in memory
+    nifi.volatile.repository.options.provenance.max.count=10000
+    # maximum number of bytes to keep in memory, also limited by option above
+    nifi.volatile.repository.options.provenance.max.bytes=1M
+
+    # maximum number of entries to keep in memory
+    nifi.volatile.repository.options.content.max.count=100000
+    # maximum number of bytes to keep in memory, also limited by option above
+    nifi.volatile.repository.options.content.max.bytes=1M
+    # limits locking for the content repository
+    nifi.volatile.repository.options.content.minimal.locking=true

Review Comment:
   I suspect the values in this sample section used to be the default values, 
but they aren't any longer.  Can you change them to the current default values, 
please?



##########
CONFIGURE.md:
##########
@@ -560,3 +633,92 @@ To notify the agent which extensions it should load see 
[Loading extensions](Ext
 
 ### JNI Functionality
 Please see the [JNI Configuration Guide](JNI.md).
+
+## Log configuration
+By default the application logs for Apache MiNiFi C++ can be found in the 
${MINIFI_HOME}/logs/minifi-app.log file with default INFO level logging. The 
logger can be reconfigured in the ${MINIFI_HOME}/conf/minifi-log.properties 
file to use different output streams, log level, and output format.
+
+### Log appenders
+In the configuration file it is possible to define different output streams by 
defining what type of appenders (log sinks) should be used for logging. The 
following appenders are supported:
+- rollingappender - logs written to this log sink are written to a file with a 
rolling policy
+- stdout - logs written to this log sink are written to the standard output
+- stderr - logs written to this log sink are written to the standard error
+- syslog - logs written to this log sink are written to the syslog
+- alert - logs written to this log sink are critical logs forwarded through 
HTTP as alerts
+- nullappender - logs written to this log sink are discarded
+
+Defining a new appender can be done in the format `appender.<appender 
name>=<appender type>` followed by defining its properties. For example here is 
how to define a rolling file appender:
+
+    # in minifi-log.properties
+    appender.rolling=rollingappender
+    appender.rolling.directory=${MINIFI_HOME}/logs
+    appender.rolling.file_name=minifi-app.log
+    appender.rolling.max_files=3
+    appender.rolling.max_file_size=5 MB
+
+Here's an example of an alert appender with its available properties:
+
+    # in minifi-log.properties
+    appender.alert1=alert
+    appender.alert1.url=<URL>
+    appender.alert1.filter=<regex pattern to match logs against>
+    appender.alert1.rate.limit=10 min
+    appender.alert1.flush.period=5 s
+    appender.alert1.batch.size=100 KB
+    appender.alert1.buffer.limit=1 MB
+    appender.alert1.level=TRACE
+    appender.alert1.ssl.context.service=<Name of the SSLContextService>
+
+### Log levels
+After the appenders are defined you can set the log level and logging target 
for each of them. Appenders can be set to log everything on a specific log 
level, but you can also define some appenders to only write logs from specific 
namespaces or classes with different log levels. The log level can be set to 
one of the following values: OFF, TRACE, DEBUG, INFO, WARN, ERROR. The log 
levels can be set in the following way:

Review Comment:
   we have CRITICAL now, too



##########
CONFIGURE.md:
##########
@@ -560,3 +633,92 @@ To notify the agent which extensions it should load see 
[Loading extensions](Ext
 
 ### JNI Functionality
 Please see the [JNI Configuration Guide](JNI.md).
+
+## Log configuration
+By default the application logs for Apache MiNiFi C++ can be found in the 
${MINIFI_HOME}/logs/minifi-app.log file with default INFO level logging. The 
logger can be reconfigured in the ${MINIFI_HOME}/conf/minifi-log.properties 
file to use different output streams, log level, and output format.
+
+### Log appenders
+In the configuration file it is possible to define different output streams by 
defining what type of appenders (log sinks) should be used for logging. The 
following appenders are supported:
+- rollingappender - logs written to this log sink are written to a file with a 
rolling policy
+- stdout - logs written to this log sink are written to the standard output
+- stderr - logs written to this log sink are written to the standard error
+- syslog - logs written to this log sink are written to the syslog
+- alert - logs written to this log sink are critical logs forwarded through 
HTTP as alerts
+- nullappender - logs written to this log sink are discarded
+
+Defining a new appender can be done in the format `appender.<appender 
name>=<appender type>` followed by defining its properties. For example here is 
how to define a rolling file appender:
+
+    # in minifi-log.properties
+    appender.rolling=rollingappender
+    appender.rolling.directory=${MINIFI_HOME}/logs
+    appender.rolling.file_name=minifi-app.log
+    appender.rolling.max_files=3
+    appender.rolling.max_file_size=5 MB
+
+Here's an example of an alert appender with its available properties:
+
+    # in minifi-log.properties
+    appender.alert1=alert
+    appender.alert1.url=<URL>
+    appender.alert1.filter=<regex pattern to match logs against>
+    appender.alert1.rate.limit=10 min
+    appender.alert1.flush.period=5 s
+    appender.alert1.batch.size=100 KB
+    appender.alert1.buffer.limit=1 MB
+    appender.alert1.level=TRACE
+    appender.alert1.ssl.context.service=<Name of the SSLContextService>
+
+### Log levels
+After the appenders are defined you can set the log level and logging target 
for each of them. Appenders can be set to log everything on a specific log 
level, but you can also define some appenders to only write logs from specific 
namespaces or classes with different log levels. The log level can be set to 
one of the following values: OFF, TRACE, DEBUG, INFO, WARN, ERROR. The log 
levels can be set in the following way:
+
+    # in minifi-log.properties
+    # Set the rolling appender to log everything with INFO level
+    logger.root=INFO,rolling
+    # But only write logs from the org::apache::nifi::minifi::FlowController 
class with ERROR level
+    
logger.org::apache::nifi::minifi::core::logging::FlowController=ERROR,rolling
+
+    # Write all error logs in the minifi namespace to the alert1 appender
+    logger.org::apache::nifi::minifi=ERROR,alert1
+
+    # Logs from the FlowController class should be written to the stderr and 
rolling appenders with DEBUG level
+    logger.org::apache::nifi::minifi::FlowController=DEBUG,stderr,rolling
+
+    # Log warnings and errors from the LoggerConfiguration class to all 
appenders
+    logger.org::apache::nifi::minifi::core::logging::LoggerConfiguration=WARN
+
+### Log pattern
+The log pattern can be changed if needed using the `spdlog.pattern` property. 
The default log pattern is the following, but there are additional examples in 
the default minifi-log.properties file:
+
+    # in minifi-log.properties
+    spdlog.pattern=[%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v

Review Comment:
   we could link to 
https://github.com/gabime/spdlog/wiki/3.-Custom-formatting#customizing-format-using-set_pattern,
 as the meaning of some of the pattern placeholders is not obvious



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to