Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Rising Star

A quick example NiFi flow to demonstrate sending logs to syslog from NiFi.

Steps:

1. Wait for new compressed files (gz) to land in folder (/tmp/nifi/syslog/src/*.gz) with log lines.

2. Decompress the file

3. Split the file into individual lines

4. Send data to syslog

NiFi Template : Download the following NiFi template and import the flow into your NiFi instance. Instructions to import a NiFi template is available here - Importing NiFi templates

send-to-syslog.xml

Send to Syslog Template Walkthrough :

The Flow is broken down into 3 sections

Section 1 : Test Data Generation

79518-screen-shot-2018-07-18-at-74906-pm.png

Section 2 : Processing (decompress files and send to local syslog)

79519-screen-shot-2018-07-18-at-74916-pm.png

Key Highlights

ExtractText Processor :

We are using the extract text processor to get the content of the flowfile into the flowfile attribute "msg". We are grabbing the entire content of the flowfile into "msg" by using the regular expression (.*). You may get only specific fields by providing appropriate regular expression here.

79521-screen-shot-2018-07-18-at-94937-pm.png

PutSyslog processor :

We are using the flowfile attribute ${msg} in the syslog message body. We have also prefixed string "NifiLogger" to the syslog message (optional).

79522-screen-shot-2018-07-18-at-95018-pm.png

Section 3 : Validation (receive syslog messages)

79520-screen-shot-2018-07-18-at-74925-pm.png


5,856 Views