Search code examples
apache-nificlouderahortonworks-data-platformmaprapache-nifi-registry

Apache nifi to append year, month and day timestamp to the merged output file


I am creating end to end flow to consume data into HDFS by using Consume Kafka for the Json files received through tealium event stream. Currently, I have used Consume Kafka -> Evaluate Json Path -> Jolttransform Json -> Merge Content -> Evaluate Json Path -> Update attribute -> PutHDFS

The requirement is to read Json Data for entire day spools into a single file referring to attribute postdate(covert epoch to YYYYMMDDSS timestamp before) and read data daily to merge into a single file and finally rename the file as per the Timestamp related to POST_DATE field to differentiate daily files. I have done all the part except renaming time stamp for the merged file as per the source attribute timestamp field. Could you please help me how to rename the file as per the attribute _year_month_day?


Solution

  • @gogocatmario, thanks for the response. Issue resolved post adding the following value for the filename property on update_attribute. tealium_es_${post_date:toDate("yyyy-MM-dd HH:mm:ss"):format("yyyy_MM_dd")}.json1