Created 10-17-2017 05:11 PM
Hi All,
I am merging the events from log source using a merge Content processor, and putting it to PutHDFS. PutHDFS writes using the filename uuid_date0901417, I need to change this filename to a more user friendly name.
I researched a little bit I found this link
http://apache-nifi.1125220.n5.nabble.com/Best-way-to-generate-a-new-filename-td8835.html
But refering this link I could change only the directory structure according to date.
I am not able to use the Updateattribute processor correctly to change the filename. How do I proceed, create a property in updateAttribute procesor and the give an expression language containing userfriendlyname_datetime. How will this EL look like?
Thanks
Dhiren
Created on 10-17-2017 05:19 PM - edited 08-17-2019 06:58 PM
in update attribute processor add new property by clicking + sign
Name of property:-
filename
value of the property:-
<what ever name you want to keep for file>
If you want to append with timestamp then use EL
<new-file-name>_${now():format("yyyyMMddHHmmss")}
Example:-
if my input filename is
foo
and i want to change the filename to bar_timestamp
then my UpdateAttribute processor new property would be
filename
bar_${now():format("yyyyMMddHHmmss")}
output filename would be
bar_20171017132115
Created on 10-17-2017 05:19 PM - edited 08-17-2019 06:58 PM
in update attribute processor add new property by clicking + sign
Name of property:-
filename
value of the property:-
<what ever name you want to keep for file>
If you want to append with timestamp then use EL
<new-file-name>_${now():format("yyyyMMddHHmmss")}
Example:-
if my input filename is
foo
and i want to change the filename to bar_timestamp
then my UpdateAttribute processor new property would be
filename
bar_${now():format("yyyyMMddHHmmss")}
output filename would be
bar_20171017132115
Created 10-17-2017 05:41 PM
@Shu Thanks a lot for quick reply. Much appreciated.
This solved the issue. The problem was once I set the expression language for creating directory structure. The putFile was looking for the directory structure hence the error. So I had to delete the PutFile processor and the use your EL and it worked like a charm. Thanks again