<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: NiFi - Creating the output directory from the content of the flow file in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231339#M72839</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929" target="_blank"&gt;@Shu&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;My Bad. I Missed to configure EvaluateJSONPath.&lt;/P&gt;&lt;P&gt;Here is my EvaluateJSONPath Processor Config,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45540-evaluatejsonpath.png" style="width: 1152px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14950i00AB2FFBE71F0A23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45540-evaluatejsonpath.png" alt="45540-evaluatejsonpath.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;workflow:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45539-workflow.png" style="width: 1189px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14951iFC04BE381BA0D2E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45539-workflow.png" alt="45539-workflow.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However while configuring EvaluateJSONPath Processor, Am ending up getting the error message as given below,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45541-error.png" style="width: 1188px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14952i52976A98B46AE0D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45541-error.png" alt="45541-error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope my workflow sequencing is correct. Please correct me if am wrong.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://community.cloudera.com/t5/image/serverpage/image-id/6537iCAA4F2F0698084B0/image-size/large?v=1.0&amp;amp;px=999" border="0" alt="evaluatejsonpath.png" title="evaluatejsonpath.png" /&gt;</description>
    <pubDate>Sun, 18 Aug 2019 00:39:03 GMT</pubDate>
    <dc:creator>bsivalingam83</dc:creator>
    <dc:date>2019-08-18T00:39:03Z</dc:date>
    <item>
      <title>NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231335#M72835</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Am ingesting the data from a MySQL DB using the executeSQL--&amp;gt;ConvertAvroToJSON--&amp;gt;PublishKafka_0_10 processor. The result will have selected columns from the Table and the extract_date. The output will look {"col1": val1, "col2": "val2", "col3": "val3", "col4": val4,"extract_date": "2017-12-21 00:17:10.0"} and the same will be stored into a Kafka topic.&lt;/P&gt;&lt;P&gt;After which i have another workflow to consume from the kafka topic and write it into a HDFS folder. [ConsumeKafka_0_10 --&amp;gt; PutHDFS]&lt;/P&gt;&lt;P&gt;My Requirement is, while consuming the messages from the kafka topic, use hour value from the extract_date field and push the messages to the corresponding hour folder in the HDFS.&lt;/P&gt;&lt;P&gt;For Example : If the field  "extract_date": is having "2017-12-21 00:17:10.0" as the value. This message should be written into HDFS under /folder/year=2017/month=12/day=21/hour=00/{filename}&lt;/P&gt;&lt;P&gt;Is there a way to achieve this use case.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bala&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2017 02:52:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231335#M72835</guid>
      <dc:creator>bsivalingam83</dc:creator>
      <dc:date>2017-12-23T02:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231336#M72836</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/44609/bsivalingam83.html" nodeid="44609" target="_blank"&gt;@Bala S&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You need to &lt;STRONG&gt;extract the extract_date value&lt;/STRONG&gt; from &lt;STRONG&gt;your content&lt;/STRONG&gt; and add that value as &lt;STRONG&gt;attribute&lt;/STRONG&gt; associated with the flowfile(EX:- if you are having json message then use&lt;STRONG&gt; evaluate json path processor&lt;/STRONG&gt;(or) if content is &lt;STRONG&gt;csv&lt;/STRONG&gt; then use &lt;STRONG&gt;extract text&lt;/STRONG&gt; processor and extract the date value and keep that value to the flowfile).&lt;/P&gt;&lt;P&gt;Once &lt;STRONG&gt;you are done with extracting the value&lt;/STRONG&gt; and the &lt;STRONG&gt;attribute is associated with the flowfile&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Then follow the below steps&lt;/P&gt;&lt;P&gt;For testing i am having &lt;STRONG&gt;extract_date&lt;/STRONG&gt; attribute with value &lt;STRONG&gt;2017-12-21 00:17:10.0 &lt;/STRONG&gt;associate with the flow file. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Then Use Update Attribute processor with below configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Add new properties for the update attribute processor as&lt;/P&gt;&lt;P&gt;day&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${extract_date:toDate("yyyy-MM-dd HH:mm:ss"):format("MM")}&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;hour&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${extract_date:toDate("yyyy-MM-dd HH:mm:ss"):format("HH")}&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;month&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${extract_date:toDate("yyyy-MM-dd HH:mm:ss"):format("MM")}&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;year&lt;/P&gt;&lt;PRE&gt;${extract_date:toDate("yyyy-MM-dd HH:mm:ss"):format("yyyy")}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45529-update.png" style="width: 1899px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14955i54887DBF0C794BD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45529-update.png" alt="45529-update.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;By using &lt;STRONG&gt;update attribute&lt;/STRONG&gt; with the following &lt;STRONG&gt;properties&lt;/STRONG&gt; we are &lt;STRONG&gt;dynamically generating year,month,day,hour&lt;/STRONG&gt; attributes based on &lt;STRONG&gt;extract_date attribute&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Then use&lt;STRONG&gt; &lt;/STRONG&gt;&lt;STRONG&gt;Put HDFS processor&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;with &lt;STRONG&gt;directory&lt;/STRONG&gt; property as&lt;/P&gt;&lt;PRE&gt;/folder/year=${year}/month=${month}/day=${day}/hour=${hour}/${filename}&lt;/PRE&gt;&lt;P&gt;We are going to add &lt;STRONG&gt;year,moth,day,hour&lt;/STRONG&gt; attributes to the flowfile using update attribute processor as mentioned above, then using those attributes to in directory property.&lt;/P&gt;&lt;P&gt;Now the &lt;STRONG&gt;put hdfs processor will create the directories in HDFS if the directory does not exists&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;If the Answer helped to resolve your issue,&lt;STRONG&gt; Click on Accept button below to accept the answer, &lt;/STRONG&gt;That would be great help to Community users to find solution quickly for these kind of errors.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://community.cloudera.com/t5/image/serverpage/image-id/7621i719768C634067F87/image-size/large?v=1.0&amp;amp;px=999" border="0" alt="update.png" title="update.png" /&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:39:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231336#M72836</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T00:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231337#M72837</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/12415"&gt;@Shu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your quick reply.&lt;/P&gt;&lt;P&gt;After i configure the above mentioned processor[updateAttribute] same as directed,&lt;/P&gt;&lt;P&gt;Am ending up with a directory structure mentioned below,&lt;/P&gt;&lt;P&gt;/folder/year=/month=/day=/hour=/677944128880138. The year, month, day and hour folders do not have the proper value populated.....&lt;/P&gt;&lt;P&gt;It should be created as /folder/year=2017/month=12/day=22/hour=19/{filename}&lt;/P&gt;&lt;P&gt;Note : The current run have the"extract_date": as "2017-12-22 19:16:17.0"&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Update Processor Configuration:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45534-updateattribute-processor.png" style="width: 1152px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14954i1EA948984BD8D96B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45534-updateattribute-processor.png" alt="45534-updateattribute-processor.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://community.cloudera.com/t5/image/serverpage/image-id/7632iF64F7DB91A93BC80/image-size/large?v=1.0&amp;amp;px=999" border="0" alt="updateattribute-processor.png" title="updateattribute-processor.png" /&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:39:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231337#M72837</guid>
      <dc:creator>bsivalingam83</dc:creator>
      <dc:date>2019-08-18T00:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231338#M72838</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/44609/bsivalingam83.html" nodeid="44609" target="_blank"&gt;@Bala S&lt;/A&gt;&lt;P&gt;I think you don't have &lt;STRONG&gt;extract_date attribute&lt;/STRONG&gt; associated with the flowfile.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Attribute screenshot:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45535-attribute.png" style="width: 914px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14953i502E98F5CB5C8534/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45535-attribute.png" alt="45535-attribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Make sure your &lt;STRONG&gt;each file &lt;/STRONG&gt;that are processing from&lt;STRONG&gt; Update Attribute processor&lt;/STRONG&gt; are having &lt;STRONG&gt;extract_date attribute&lt;/STRONG&gt; associate with them.To &lt;STRONG&gt;check&lt;/STRONG&gt; attribute &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Right Click on queue&lt;/LI&gt;&lt;LI&gt;click on list queue &lt;/LI&gt;&lt;LI&gt;select any of the flowfile &lt;/LI&gt;&lt;LI&gt;click on Attributes tab then you need to have extract_date attribute with the value.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If you don't have &lt;STRONG&gt;any value then the directory name would be empty&lt;/STRONG&gt;(same issue you are facing now).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;How to add attribute to the flowfile?&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;You need to &lt;STRONG&gt;extract the extract_date value&lt;/STRONG&gt; from &lt;STRONG&gt;your content&lt;/STRONG&gt; and add that value as &lt;STRONG&gt;attribute&lt;/STRONG&gt; associated with the flowfile&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:- &lt;/U&gt;&lt;/STRONG&gt;if you are having json message then use&lt;STRONG&gt; evaluate json path processor&lt;/STRONG&gt;(or) if content is &lt;STRONG&gt;csv&lt;/STRONG&gt; then use &lt;STRONG&gt;extract text&lt;/STRONG&gt; processor and extract the date value and keep that value to the flowfile.&lt;STRONG&gt;&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Once &lt;STRONG&gt;you are done with extracting the value&lt;/STRONG&gt; and the &lt;STRONG&gt;attribute is associated with the flowfile&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:39:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231338#M72838</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T00:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231339#M72839</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929" target="_blank"&gt;@Shu&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;My Bad. I Missed to configure EvaluateJSONPath.&lt;/P&gt;&lt;P&gt;Here is my EvaluateJSONPath Processor Config,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45540-evaluatejsonpath.png" style="width: 1152px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14950i00AB2FFBE71F0A23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45540-evaluatejsonpath.png" alt="45540-evaluatejsonpath.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;workflow:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45539-workflow.png" style="width: 1189px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14951iFC04BE381BA0D2E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45539-workflow.png" alt="45539-workflow.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However while configuring EvaluateJSONPath Processor, Am ending up getting the error message as given below,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="45541-error.png" style="width: 1188px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14952i52976A98B46AE0D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="45541-error.png" alt="45541-error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope my workflow sequencing is correct. Please correct me if am wrong.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://community.cloudera.com/t5/image/serverpage/image-id/6537iCAA4F2F0698084B0/image-size/large?v=1.0&amp;amp;px=999" border="0" alt="evaluatejsonpath.png" title="evaluatejsonpath.png" /&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:39:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231339#M72839</guid>
      <dc:creator>bsivalingam83</dc:creator>
      <dc:date>2019-08-18T00:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231340#M72840</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Now its working fine. The issue is with the configuartion in EvaluateJSONPath processor.&lt;/P&gt;&lt;P&gt;I missed a "." for the attribute to fetch. I have accepted the answer. Thanks a lot for your help!!!&lt;/P&gt;&lt;PRE&gt;It should be "$.extract_date" instead of "$extract_date"		&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Dec 2017 05:31:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231340#M72840</guid>
      <dc:creator>bsivalingam83</dc:creator>
      <dc:date>2017-12-23T05:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Creating the output directory from the content of the flow file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231341#M72841</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I am trying to create the directory with current time stamp in hdfs and as above I tried but did not work since it doesnt have &lt;/P&gt;&lt;PRE&gt;extract_date &lt;/PRE&gt;&lt;P&gt;what should I use to get the desire output ?&lt;/P&gt;&lt;P&gt;Right now my flow is : ListHDFS -----&amp;gt; Updateattribute -----&amp;gt;PutHDFS.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;any suggestions please ?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 03:02:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-the-output-directory-from-the-content-of-the/m-p/231341#M72841</guid>
      <dc:creator>Jasthi</dc:creator>
      <dc:date>2019-06-13T03:02:27Z</dc:date>
    </item>
  </channel>
</rss>

