My Regex for File Filter Attribute in NiFi GetFile Processor is Failing -


i have list of files copy hdfs.

the file names like:

  1. sample-11072016
  2. sample-11082016
  3. sample-11062016
  4. sample-11062016
  5. denodo-09082016
  6. denodo-09122016
  7. denodo-11082016
  8. denodo-11072016

now trying write regex pick today's sample file. digits following file dates in

sample-11082016 file of date 11/08/2016

the regex tried [sample]-(0-9){8} regex return sample files of dates checking 8 digits. please suggest on how find file today's date. problem here file name sample stays constant date keeps changing. have write regex pick file of today's date only.

i pretty new regex, possible write regex check if date today's date.

any suggestions help. nifi regex rules same java regex rules. regex expression should used against file filter attribute of getfile processor

regards,

sai_pb.

you're there on regex. putting "sample" in between square brackets ('[' , ']'), you're saying "the first character should match 1 of these characters". here link explains bit more in depth (see "character classes" section).

also putting "0-9" in paranthesis, you're saying "capture group matches characters '0-9' exactly". here want square brackets.

so regex should using "sample-[0-9]{8}" (you can use "\d" instead of "0-9" wanted keep of initial regex possible).

you can test regex using website.

in order solve second problem of picking current day's log file, should able use above regex file filter. adjust "scheduling strategy" run once day (after file expected written day). lastly set "maximum file age" "24h" (adjust necessary sure latest valid). these configurations cause processor run once per day, picking file matches appropriate filter , not older day old.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -