I want to make log files for each processors in NiFi. I use splitText for splitting log files and then processing them after it I have one log message distribute in 5 files. I want to keep this data and write it in one log file for each processor (for example I use this expression fro getting executescript processor${regex:toLower():contains('executescript')}).
- How can I write this logs in one log file for each processor?
- Should I use any native NiFi processor or make it by Groovy code?
Is it possible to get flowfile data I used this but processor seems to have bad response:
def flowFile1 = session.create();
def flowFile=session.get();
while(flowFile != null){
flowFile1 = session.write(flowFile, {outputStream -> def builder = new groovy.json.JsonBuilder(flowFile)
outputStream.write(builder.toPrettyString().getBytes(StandardCharsets.UTF_8)) } as OutputStreamCallback)
}
flowFile1 = session.putAttribute(flowFile,'filename','ExecuteScriptLog')
session.remove(flowFile);
session.transfer(flowFile1, REL_SUCCESS)
I have WorkFlow ike thi and i wnat to get connection name for example 'executescrip't and make flowfile with this name and input all flowfile data whcih is placed inside this 'executescript' queue and write it in one file created by me (in this case 'executescript')