<?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 How to derive by generating conditions with routeoncontent processor? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212831#M69662</link>
    <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;I have a set of syslog lines coming in one by one. Since I want to send them to different processors for storage, I want to derive them according to a series of conditions. &lt;/P&gt;&lt;P&gt;A fellow member of the community indicated to me that he could use the RouteOnContent processor. In fact I have derived the logs according to a contained word towards one site or another. &lt;/P&gt;&lt;P&gt;Property Country = (. *USA. *)&lt;/P&gt;&lt;P&gt;But the problem I have now is that I find it necessary that the condition to derive is more than one word and I am not sure how to do it. &lt;/P&gt;&lt;P&gt;e. g. my log line is as follows: &lt;/P&gt;&lt;P&gt;2017, michigan, january, rainy, 20, eeuu, cloudy &lt;/P&gt;&lt;P&gt;I want to send to the site' A' if it contains the word January and USA. &lt;/P&gt;&lt;P&gt;I want to send to site' B' if it contains January and cloudy &lt;/P&gt;&lt;P&gt;I want to send to site' C' if it contains January or February and the USA. &lt;/P&gt;&lt;P&gt;Thank you so much for the help.&lt;/P&gt;</description>
    <pubDate>Sun, 15 Oct 2017 20:58:16 GMT</pubDate>
    <dc:creator>xavwebmaster</dc:creator>
    <dc:date>2017-10-15T20:58:16Z</dc:date>
    <item>
      <title>How to derive by generating conditions with routeoncontent processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212831#M69662</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;I have a set of syslog lines coming in one by one. Since I want to send them to different processors for storage, I want to derive them according to a series of conditions. &lt;/P&gt;&lt;P&gt;A fellow member of the community indicated to me that he could use the RouteOnContent processor. In fact I have derived the logs according to a contained word towards one site or another. &lt;/P&gt;&lt;P&gt;Property Country = (. *USA. *)&lt;/P&gt;&lt;P&gt;But the problem I have now is that I find it necessary that the condition to derive is more than one word and I am not sure how to do it. &lt;/P&gt;&lt;P&gt;e. g. my log line is as follows: &lt;/P&gt;&lt;P&gt;2017, michigan, january, rainy, 20, eeuu, cloudy &lt;/P&gt;&lt;P&gt;I want to send to the site' A' if it contains the word January and USA. &lt;/P&gt;&lt;P&gt;I want to send to site' B' if it contains January and cloudy &lt;/P&gt;&lt;P&gt;I want to send to site' C' if it contains January or February and the USA. &lt;/P&gt;&lt;P&gt;Thank you so much for the help.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 20:58:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212831#M69662</guid>
      <dc:creator>xavwebmaster</dc:creator>
      <dc:date>2017-10-15T20:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive by generating conditions with routeoncontent processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212832#M69663</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/45374/xavwebmaster.html" nodeid="45374" target="_blank"&gt;@xav webmaster&lt;/A&gt;, we can do this by using routeoncontent processors, But in your case &lt;STRONG&gt;the problem&lt;/STRONG&gt; is your &lt;STRONG&gt;siteA and siteC&lt;/STRONG&gt; having &lt;STRONG&gt;jan and usa&lt;/STRONG&gt; as&lt;STRONG&gt; common check &lt;/STRONG&gt;on content, you need to come up with &lt;STRONG&gt;unique way&lt;/STRONG&gt; how to route content to &lt;STRONG&gt;siteA or siteC&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;by using RouteOnContent Processor:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This processor also results &lt;STRONG&gt;same output as routetext &lt;/STRONG&gt;but in this processor we &lt;STRONG&gt;won't&lt;/STRONG&gt; have &lt;STRONG&gt;ignore case property,&lt;/STRONG&gt; so we need to prepare regex which matches january or January or jaNuary.&lt;/P&gt;&lt;P&gt;The below regex ignores all the case mentioned above&lt;/P&gt;&lt;PRE&gt;.*[Jj][Aa][Nn][Uu][Aa][Rr][Yy].*&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.change the properties&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Match Requirement&lt;/STRONG&gt; to &lt;STRONG&gt;content must contain match&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2.add the below properties&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;jan and cloudy &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;(.*January.*Cloudy) // checks if the content haiving january and cloudy in it
Example:- 2017, michigan, January, rainy, 20, eeuu, Cloudy&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;jan and usa&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;(.*January.*USA) //checks if the content having january and usa in it
Example:- 2017, michigan, January, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;jan or feb and usa&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;(January|February).*(USA) //checks if the content having jan or feb and usa
Example:- 
2017, michigan, February, rainy, 20, eeuu, USA
2017, michigan, January, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;in this case both content satisfies regex&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Processor Configs:-&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="40858-routeoncontent.png" style="width: 723px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16540i34EEA76DE41B0B9D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40858-routeoncontent.png" alt="40858-routeoncontent.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;in addition:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How &lt;STRONG&gt;RouteText&lt;/STRONG&gt; processor works?&lt;/P&gt;&lt;P&gt; if you are having content with 50 lines in it and we wants to route the content, this &lt;STRONG&gt;processor compares each line&lt;/STRONG&gt; with our&lt;STRONG&gt; propertie&lt;/STRONG&gt;s and&lt;STRONG&gt; routes the matching lines&lt;/STRONG&gt; to those &lt;STRONG&gt;relationships&lt;/STRONG&gt;.&lt;/P&gt;&lt;PRE&gt;i.e 1 input file(multiple lines of content) and multiple outputs based on relations that we specified in processor configurations&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example input:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;2017, michigan, January, rainy, 20, eeuu, Cloudy
2017, michigan, January, rainy, 20, eeuu, USA
2017, michigan, February, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;output:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;jan and usa relation gets&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;2017, michigan, January, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;jan and cloudy&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt; 2017, michigan, January, rainy, 20, eeuu, Cloudy&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;jan or feb and usa&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;2017, michigan, January, rainy, 20, eeuu, USA
2017, michigan, February, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;if the &lt;STRONG&gt;content of flowfile&lt;/STRONG&gt; will have only &lt;STRONG&gt;1 line&lt;/STRONG&gt; in it, in that case we can use &lt;STRONG&gt;routetext&lt;/STRONG&gt; processor and it works same as &lt;STRONG&gt;routeoncontent &lt;/STRONG&gt;as mentioned above&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Processor Configurations:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.change the properties&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Matching Strategy &lt;/STRONG&gt;to &lt;STRONG&gt;Contains Regular Expression&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ignore case&lt;/STRONG&gt; to &lt;STRONG&gt;true&lt;/STRONG&gt; //it ignores UPPER or lower case&lt;/P&gt;&lt;P&gt;2.add properties as follows&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;jan and cloudy &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;(.*January.*Cloudy) // checks if the content haiving january and cloudy in it
Example:- 2017, michigan, January, rainy, 20, eeuu, Cloudy&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;jan and usa&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;(.*January.*USA) //checks if the content having january and usa in it
Example:- 2017, michigan, January, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;jan or feb and usa&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;(January|February).*(USA) //checks if the content having jan or feb and usa
Example:- 
2017, michigan, February, rainy, 20, eeuu, USA
2017, michigan, January, rainy, 20, eeuu, USA&lt;/PRE&gt;&lt;P&gt;in this case both content satisfies regex&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Processor configs:-&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="40856-routecontent.png" style="width: 648px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16541iF26C551EAFEFEE1A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40856-routecontent.png" alt="40856-routecontent.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;If your &lt;STRONG&gt;content&lt;/STRONG&gt; of &lt;STRONG&gt;flowfile is one line at a time&lt;/STRONG&gt; you can use either &lt;STRONG&gt;routetext (or) routeoncontent &lt;/STRONG&gt;processors, the results from &lt;STRONG&gt;both of them are same. &lt;/STRONG&gt;As you can choose which best fit for your case.&lt;/LI&gt;&lt;LI&gt;if your contents are more than one line at a time then by using&lt;STRONG&gt; routetext &lt;/STRONG&gt;we can routes the matching lines to different relations (or) use &lt;STRONG&gt;splittext processor &lt;/STRONG&gt;to split each line as a flowfile then use either &lt;STRONG&gt;routetext (or) routeoncontent &lt;/STRONG&gt;processors.&lt;/LI&gt;&lt;LI&gt;if your&lt;STRONG&gt; contents are more than one line at a time&lt;/STRONG&gt; and you want to&lt;STRONG&gt; route the whole content &lt;/STRONG&gt;based on&lt;STRONG&gt; some property&lt;/STRONG&gt; then use &lt;STRONG&gt;routeoncontent&lt;/STRONG&gt; processor it will compares &lt;STRONG&gt;whole contents(not line by line as routetext)&lt;/STRONG&gt; and redirects the &lt;STRONG&gt;whole contents&lt;/STRONG&gt; to &lt;STRONG&gt;matching relationships.&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 03:44:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212832#M69663</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T03:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive by generating conditions with routeoncontent processor?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212833#M69664</link>
      <description>&lt;P&gt;That's a great answer. Thank you so much for the help. It'll really come in handy. I can see that he has taken time to respond, and I thank him for that.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 02:45:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-derive-by-generating-conditions-with-routeoncontent/m-p/212833#M69664</guid>
      <dc:creator>xavwebmaster</dc:creator>
      <dc:date>2017-10-16T02:45:28Z</dc:date>
    </item>
  </channel>
</rss>

