5-0 Error Handling in NiFi Flows
Many of the example flows presented in this cookbook have auto-terminated relationships that represent error conditions, such as "failure", "unmatched", etc. Here we demonstrate a few patterns for handling those errors.
Example 1: Log attributes and save content file
Processors:
- UpdateAttribute
- Properties
- error.condition: (Your message about this error condition.)
- Properties
- LogAttribute – write to nifi-app.log
- Properties
- Attributes to Log: filename, error.condition (, any other attributes that are relevant to your flow and/or error condition.)
- Properties
- PutFile – write error file to the file system
- Properties
- Directory: ./error-files (or wherever you want the files to go)
- Settings
- Automatically Terminate Relationships: failure, success
- Properties
![](../images/05-000 Error Handling.png)