- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Nifi date filename
- Labels:
-
Apache NiFi
Created ‎12-26-2016 08:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm constantly moving logs for storage and was looking for a way to change the filenames in a given nifi flow. for example, if i'm getting a load of files from say /var/log*, is there a way in my flow that i'm using to adjust the filename and add on to it so i have the date?So for example if i have webapp.log, i would like to move it and have the file name changed to webapp.log(todaysdate). Is there a processor in NiFi that will do this?
Created on ‎12-26-2016 08:14 PM - edited ‎08-18-2019 03:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your best option for doing this is going to be using the UpdateAttribute processor and then using a little NiFi Expression Language to append the date onto your file. From there you should be able to configure. I created a sample flow and used the following config and achieved the following results:
/var/log/log1.log
New filename: log1.log.2016-12-26 15:10:25.966Z
This is the config on the updateAttribute processor:
This is just a sample, you could do a lot better using append/prepend with NiFi Expression Language. There is more info here: https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
Created on ‎12-26-2016 08:14 PM - edited ‎08-18-2019 03:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your best option for doing this is going to be using the UpdateAttribute processor and then using a little NiFi Expression Language to append the date onto your file. From there you should be able to configure. I created a sample flow and used the following config and achieved the following results:
/var/log/log1.log
New filename: log1.log.2016-12-26 15:10:25.966Z
This is the config on the updateAttribute processor:
This is just a sample, you could do a lot better using append/prepend with NiFi Expression Language. There is more info here: https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
