<?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: How to split , convert and concat dynamic String to an insert into statement ? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-How-to-split-convert-and-concat-dynamic-String-to-an/m-p/216580#M66601</link>
    <description>&lt;P&gt;Got the solution:&lt;BR /&gt;&lt;BR /&gt;1. Replace String with actual year &lt;/P&gt;&lt;P&gt;search value: &amp;lt;(.*?)&amp;gt;&lt;BR /&gt;Replacement Value: ${now():format('yyyy ')}&lt;/P&gt;&lt;P&gt;2. Extract Timestamp and Message&lt;BR /&gt;time = (^.{20})&lt;BR /&gt;message = (^.*$)&lt;/P&gt;&lt;P&gt;3. Replace String with insert into clause:&lt;BR /&gt;search value: (?s)(^.*$)&lt;BR /&gt;Replacement Value: insert into syslog values ('${time:substring(0,20):toDate('yyyy MMM dd HH:mm:ss'):format('yyyy-MM-dd HH:mm:ss')}','${message:substring(21):substringBefore(' ')}','${message:substring(21):substringAfter(' ')}');&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2017 16:48:39 GMT</pubDate>
    <dc:creator>timo_burmeister</dc:creator>
    <dc:date>2017-08-16T16:48:39Z</dc:date>
    <item>
      <title>Nifi: How to split , convert and concat dynamic String to an insert into statement ?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-How-to-split-convert-and-concat-dynamic-String-to-an/m-p/216579#M66600</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;i have the following input single row FlowFiles:&lt;/P&gt;&lt;P&gt;Aug  9 10:34:12 sysxyz-p2 sudo: pam_unix(sudo:session): session opened for user root by (uid=0)&lt;BR /&gt;Aug 10 10:34:12 sysxxx.xxx.xx sudo: pam_unix(sudo:session): session opened for user root by (uid=0)&lt;BR /&gt;Aug 11 10:34:12 sysxxx.xxx.xx sudo: pam_unix(sudo:session): session closed for user root&lt;BR /&gt;Aug 12 10:34:12 sysxxx.xxx.xyz sudo: pam_unix(sudo:session): session closed for user root&lt;BR /&gt;Aug 13 10:34:01 sysxxx.xxx.xx CRON[26312]: pam_unix(cron:session): session opened for user monadmin by (uid=0)&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;1. Split the Flow into timestamp, host, message fields:&lt;/P&gt;&lt;P&gt;timestamp               host                    message                                 &lt;/P&gt;&lt;P&gt;Aug   9 10:34:12     sysxyz-p2           sudo: pam_unix(sudo:session): session opened for user root by (uid=0)&lt;BR /&gt;Aug 10 10:34:12     sysxxx.xxx.xx     sudo: pam_unix(sudo:session): session opened for user root by (uid=0)&lt;BR /&gt;Aug 11 10:34:12     sysxxx.xxx.xx     sudo: pam_unix(sudo:session): session closed for user root&lt;BR /&gt;Aug 12 10:34:12    sysxxx.xxx.xyz    sudo: pam_unix(sudo:session): session closed for user root&lt;BR /&gt;Aug 13 10:34:01    sysxxx.xxx.xx     CRON[26312]: pam_unix(cron:session): session opened for user monadmin by (uid=0)&lt;/P&gt;&lt;P&gt;2. Convert timestamp Format:&lt;/P&gt;&lt;P&gt;Aug   9 10:34:12       - &amp;gt;   'YYYY.MM.DD HH:MI:SS'&lt;/P&gt;&lt;P&gt;3. Concat the extracted files to insert into ... string:&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;insert into table ('2017-08-09 10:34:12', 'sysxyz-p2', 'sudo: pam_unix(sudo:session): session opened for user root by (uid=0)';&lt;BR /&gt;&lt;BR /&gt;Thanks for you help!&lt;BR /&gt;Timo&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 21:00:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-How-to-split-convert-and-concat-dynamic-String-to-an/m-p/216579#M66600</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-08-14T21:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi: How to split , convert and concat dynamic String to an insert into statement ?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-How-to-split-convert-and-concat-dynamic-String-to-an/m-p/216580#M66601</link>
      <description>&lt;P&gt;Got the solution:&lt;BR /&gt;&lt;BR /&gt;1. Replace String with actual year &lt;/P&gt;&lt;P&gt;search value: &amp;lt;(.*?)&amp;gt;&lt;BR /&gt;Replacement Value: ${now():format('yyyy ')}&lt;/P&gt;&lt;P&gt;2. Extract Timestamp and Message&lt;BR /&gt;time = (^.{20})&lt;BR /&gt;message = (^.*$)&lt;/P&gt;&lt;P&gt;3. Replace String with insert into clause:&lt;BR /&gt;search value: (?s)(^.*$)&lt;BR /&gt;Replacement Value: insert into syslog values ('${time:substring(0,20):toDate('yyyy MMM dd HH:mm:ss'):format('yyyy-MM-dd HH:mm:ss')}','${message:substring(21):substringBefore(' ')}','${message:substring(21):substringAfter(' ')}');&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 16:48:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-How-to-split-convert-and-concat-dynamic-String-to-an/m-p/216580#M66601</guid>
      <dc:creator>timo_burmeister</dc:creator>
      <dc:date>2017-08-16T16:48:39Z</dc:date>
    </item>
  </channel>
</rss>

