<?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: Append multiple tweets into single file using NIFI PutFile in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164760#M41464</link>
    <description>&lt;P&gt;thanks for your valuable suggestion &lt;A href="https://community.hortonworks.com/users/5078/pvillard.html"&gt;Pierre Villard.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Its done.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Sep 2016 17:54:49 GMT</pubDate>
    <dc:creator>mohan221213</dc:creator>
    <dc:date>2016-09-22T17:54:49Z</dc:date>
    <item>
      <title>Append multiple tweets into single file using NIFI PutFile</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164758#M41462</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I am trying to get the tweets using nifi and store those into a local file.&lt;/P&gt;&lt;P&gt;I have used the following configurations to get the tweets using GetTwitter process&lt;/P&gt;&lt;PRE&gt;Twitter Endpoint :- Filter Endpoint
given all twitter keys
Languages :- en
Terms to Filter On :- facebook,wipro,google&lt;/PRE&gt;&lt;P&gt;Trying to put the tweets into a file using PutFile&lt;/P&gt;&lt;P&gt;Configurations that i have used are,&lt;/P&gt;&lt;PRE&gt;Directory:- /root/tweets
Conflict Resolution Strategy:- fail
Create Missing Directories :-true
Maximum File Count :- 1
Last Modified Time :-
Permissions:-rw-r--r--
Owner:-root
Group:- root&lt;/PRE&gt;&lt;P&gt;I am able to get the tweet but that is &lt;STRONG&gt;ONE per ONE JSON FILE.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If I increase the Maximum File Count to 20 then it creates 20 json files and each file contains only one tweet.&lt;/P&gt;&lt;P&gt;But I want it to be store all the tweets in single json file.&lt;/P&gt;&lt;P&gt;In this &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/42149/using-nifi-to-collect-tweets-into-one-large-file.html"&gt;https://community.hortonworks.com/questions/42149/using-nifi-to-collect-tweets-into-one-large-file.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;they have mentioned to use MergeContent processor.&lt;/P&gt;&lt;P&gt;But I didnt get it how to use MergeContent exactly as I am completely new to NIFI.&lt;/P&gt;&lt;P&gt;Please sugget me how to use.&lt;/P&gt;&lt;P&gt;Do i have to use it after the Putfile or Before PutFile.&lt;/P&gt;&lt;P&gt;please help.&lt;/P&gt;&lt;P&gt;Mohan.V&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 14:26:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164758#M41462</guid>
      <dc:creator>mohan221213</dc:creator>
      <dc:date>2016-09-22T14:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Append multiple tweets into single file using NIFI PutFile</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164759#M41463</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/10889/mohan221213.html" nodeid="10889"&gt;@Mohan V&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Yes, MergeContent would be a solution to your problem. You have to use it before the PutFile processor in order to merge multiple flow files (each containing one json) into one flow file (containing multiple json). You may want to have a look at the documentation here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.MergeContent/index.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.MergeContent/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In particular you have a property specifying the number of JSON you want to be merged into one single file: 'Minimum Number of Entries'&lt;/P&gt;&lt;P&gt;As a side note, when you have a processor on your canvas, you can right click on it and go to 'Usage' to display the documentation of the processor.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 14:56:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164759#M41463</guid>
      <dc:creator>pvillard</dc:creator>
      <dc:date>2016-09-22T14:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Append multiple tweets into single file using NIFI PutFile</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164760#M41464</link>
      <description>&lt;P&gt;thanks for your valuable suggestion &lt;A href="https://community.hortonworks.com/users/5078/pvillard.html"&gt;Pierre Villard.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Its done.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 17:54:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/164760#M41464</guid>
      <dc:creator>mohan221213</dc:creator>
      <dc:date>2016-09-22T17:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Append multiple tweets into single file using NIFI PutFile</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/286166#M41465</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do face a similar situation. I have tried using MergeContent before the PutFile. It is ending up with the&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;U&gt;Error:&lt;/U&gt;&lt;/STRONG&gt;&lt;FONT color="#FF0000"&gt;file with the same name already exists.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;My Data flow is:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ConsumeMQTT&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(Reads Source) --&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;MergeContent&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(MergeFile) --&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;PutFile&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(Writes File)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If i setup the "Conflict Resolution Strategy" in the PutFile to "replace", this flow is working as only the latest value gets stored in the file. I cannot append data in the same file using the data flow as above.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly your inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2019 08:20:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/286166#M41465</guid>
      <dc:creator>Siraj</dc:creator>
      <dc:date>2019-12-23T08:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Append multiple tweets into single file using NIFI PutFile</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/286198#M41466</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/72165"&gt;@Siraj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The NiFi putFile processor does not support append.&amp;nbsp; Append actions can cause all kinds of issue especially with a NiFi cluster where the target directory of the putFile is mounted to all the NiFi nodes.&lt;BR /&gt;You can't have multiple nodes trying to write/append to the same file at the same time.&lt;BR /&gt;&lt;BR /&gt;My suggestion would be to use the UpdateAttribute processor before your putFile to modify the filename attribute.&amp;nbsp; &amp;nbsp;Perhaps prepend a uuid to the filename to ensure uniqueness across multiple files or NiFi nodes (if clustered).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${UUID()}-${filename}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2019 17:58:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/286198#M41466</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-12-23T17:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Append multiple tweets into single file using NIFI PutFile</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/286216#M41467</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the details. I can understand your point that same file cannot be accessed across cluster nodes. But,&amp;nbsp;I&lt;EM&gt; am using Nifi is single node (without cluster) and was thinking that this should work&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, i do use "Update Attribute" with the below file name conventions. This generates separate flow file for every message. I am trying to have this as one single file per node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;${filename:replace(${filename},"FileName_"):append(${now():format("yyyy-MM-dd-HH-mm-ss")})}.Json&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 05:55:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Append-multiple-tweets-into-single-file-using-NIFI-PutFile/m-p/286216#M41467</guid>
      <dc:creator>Siraj</dc:creator>
      <dc:date>2019-12-24T05:55:31Z</dc:date>
    </item>
  </channel>
</rss>

