<?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: Logging Executed SQL Commands in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347569#M235214</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99150"&gt;@Lewis_King&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an idea. You can fork the "a" output of the QueryRecord processor and send it to a sequence of processors as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="araujo_0-1657779304024.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34868iAE50EE2E948F601F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="araujo_0-1657779304024.png" alt="araujo_0-1657779304024.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The ReplaceText processor will simply replace the entire contents of the flowfile with the information you want to register in the log. For example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="araujo_1-1657779389864.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34869iECE3A33FD88C16CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="araujo_1-1657779389864.png" alt="araujo_1-1657779389864.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This will produce one row per flow file with the source type ("a") and the timestamp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can them send these to a MergeRecord to avoid saving to many small log files and them to a PutFile to persist the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can process the "b" output in a similar way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2022 06:20:17 GMT</pubDate>
    <dc:creator>araujo</dc:creator>
    <dc:date>2022-07-14T06:20:17Z</dc:date>
    <item>
      <title>Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347458#M235179</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached below is a flow I have created to perform a simple sorting task with a given CSV file&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="화면 캡처 2022-07-13 170027.png" style="width: 800px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34857i633180357C6BFCF3/image-size/large?v=v2&amp;amp;px=999" role="button" title="화면 캡처 2022-07-13 170027.png" alt="화면 캡처 2022-07-13 170027.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. Getfile processor brings the target CSV file into the flow&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. QueryRecord processor executes SQL commands and send the flowfile two ways&lt;/P&gt;&lt;P&gt;3. Each flow file is saved into Postgresql database with PutDatabaseRecord processors.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am trying to do is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Keep a log of all SQL commands that are executed on Queryrecord processor and keep timestamp (When they were executed) of them&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Save the log into a Postgresql table named 'validation_log" that has 3 columns. (CSV file name, SQL command, Timestamp)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this work?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 08:06:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347458#M235179</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-13T08:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347519#M235196</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If I understood you correctly you want to log some information when the QueryRecord is executed, in this case you can use the Original relationship coming out of the QueryRecord where you can log the information like filename,timestamp...etc.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 16:18:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347519#M235196</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2022-07-13T16:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347540#M235206</link>
      <description>&lt;P&gt;Thank you for the reply !. Can you suggest a processor that will perform the task you mentioned? Would LogAttribute do ?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 23:44:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347540#M235206</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-13T23:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347546#M235207</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99150"&gt;@Lewis_King&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Keep a log of all SQL commands...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What do you mean by the above? The QueryRecord processor always executes the &lt;EM&gt;same SQL query&lt;/EM&gt;, which you configure in the processor as a relationship. The SQL query doesn't change; what changes are the flowfiles that go through the processor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;André&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 01:44:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347546#M235207</guid>
      <dc:creator>araujo</dc:creator>
      <dc:date>2022-07-14T01:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347549#M235210</link>
      <description>&lt;P&gt;Oh I guess I didnt make my question clear here.&lt;/P&gt;&lt;P&gt;for example , when I have 2 SQL queries (a, b) set on my Queryrecord Processor,&lt;/P&gt;&lt;P&gt;I want to find out if I can keep a log like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL query&amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; Timestamp (Time of the query execution)&lt;/P&gt;&lt;P&gt;a&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20220714, 12:00&lt;/P&gt;&lt;P&gt;b&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20220714 , 12:00&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 03:00:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347549#M235210</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-14T03:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347564#M235211</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99150"&gt;@Lewis_King&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want to append one row for each flowfile or one row for each processed record to this log?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 05:48:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347564#M235211</guid>
      <dc:creator>araujo</dc:creator>
      <dc:date>2022-07-14T05:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347565#M235212</link>
      <description>&lt;P&gt;One row for each flowfile would do !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 06:03:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347565#M235212</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-14T06:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347566#M235213</link>
      <description>&lt;P&gt;Actually can you show me both methods ? Thank you so much for help !&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 06:06:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347566#M235213</guid>
      <dc:creator>Lewis_King</dc:creator>
      <dc:date>2022-07-14T06:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Logging Executed SQL Commands</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347569#M235214</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99150"&gt;@Lewis_King&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an idea. You can fork the "a" output of the QueryRecord processor and send it to a sequence of processors as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="araujo_0-1657779304024.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34868iAE50EE2E948F601F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="araujo_0-1657779304024.png" alt="araujo_0-1657779304024.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The ReplaceText processor will simply replace the entire contents of the flowfile with the information you want to register in the log. For example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="araujo_1-1657779389864.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34869iECE3A33FD88C16CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="araujo_1-1657779389864.png" alt="araujo_1-1657779389864.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This will produce one row per flow file with the source type ("a") and the timestamp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can them send these to a MergeRecord to avoid saving to many small log files and them to a PutFile to persist the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can process the "b" output in a similar way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 06:20:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Logging-Executed-SQL-Commands/m-p/347569#M235214</guid>
      <dc:creator>araujo</dc:creator>
      <dc:date>2022-07-14T06:20:17Z</dc:date>
    </item>
  </channel>
</rss>

