Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

In NiFi how do I append RouteText lines to an existing target file (PutFile functionality)?

avatar
Guru

I have a RouteText processor outputting matched lines that I would like to append to an existing local file using PutFile. However, PutFile cannot append content to an existing file (am I wrong?). How do I do this in NiFi? Is the only way to do it by using a script in ExecuteScript to open and append a file? Seems like a native Processor should do this.

1 ACCEPTED SOLUTION

avatar

@Greg Keys unfortunately I think you are correct that ExecuteScript is the best way to achieve this right now. As far as I know, the PutFile processor cannot append to an existing file. You are given the option to deal with conflicting files using "replace", "ignore", or "fail" as a resolution strategy. You should submit an Apache Jira to add this functionality. I could see difficulties with file locks and flushing the buffer given the streaming nature of NiFi and I think further investigation is needed.

View solution in original post

1 REPLY 1

avatar

@Greg Keys unfortunately I think you are correct that ExecuteScript is the best way to achieve this right now. As far as I know, the PutFile processor cannot append to an existing file. You are given the option to deal with conflicting files using "replace", "ignore", or "fail" as a resolution strategy. You should submit an Apache Jira to add this functionality. I could see difficulties with file locks and flushing the buffer given the streaming nature of NiFi and I think further investigation is needed.