<?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>topic Re: Rex for Source in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206087#M59958</link>
    <description>&lt;P&gt;after the question mark "?", you need to add the  or &amp;lt;output&amp;gt; field&lt;BR /&gt;
I don't know why I can't type those "angle bracket"  in the answer like &amp;lt;&amp;gt; or &amp;lt;&amp;gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Sep 2016 10:22:59 GMT</pubDate>
    <dc:creator>haley_swarnapat</dc:creator>
    <dc:date>2016-09-22T10:22:59Z</dc:date>
    <item>
      <title>Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206084#M59955</link>
      <description>&lt;P&gt;My source filed has value such as,&lt;/P&gt;

&lt;P&gt;/Folder1/Folder2/Folder3/Folder4/Folder5/LoadABCDEF_20160921.log &lt;/P&gt;

&lt;P&gt;I would like to extract the "LoadABCDEF" from the source.&lt;/P&gt;

&lt;P&gt;Similarly &lt;/P&gt;

&lt;P&gt;/Folder1/Folder2/Folder3/OrderOnline_ABCD/Folder4/ path&lt;BR /&gt;
 I would like to fetch "OrderOnline_ABCD" from the source.&lt;/P&gt;

&lt;P&gt;can someone help me how to fetch the application name from the source?&lt;BR /&gt;
| rex field=source "*" &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206084#M59955</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2020-09-29T11:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206085#M59956</link>
      <description>&lt;P&gt;/Folder1/Folder2/Folder3/Folder4/Folder5/LoadABCDEF_20160921.log&lt;BR /&gt;
I would like to extract the "LoadABCDEF" from the source.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;the updated query -&lt;/STRONG&gt; &lt;BR /&gt;
    | rex field=source "\/(?&lt;SOURCEREX&gt;\w+)_" | table sourceRex&lt;BR /&gt;
/Folder1/Folder2/Folder3/OrderOnline_ABCD/Folder4/ path&lt;BR /&gt;
I would like to fetch "OrderOnline_ABCD" from the source(Folder3 may contains an underscore).&lt;/SOURCEREX&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "(\/\w+){3}\/(?&amp;lt;rexOutput&amp;gt;\w+)\S+" | table rexOutput   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for learning, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/ -- for matching(escaping) the first "/"
\w+ --- match any word character(letter, number, or _) ("+" means, one or more match)
{3} ---- match 3 times 
(/Folder1/Folder2/Folder3/ will be matched till this) then, we need create our rex extraction.
?&amp;lt;rexOutput&amp;gt; --- assign rex extraction to this variable.
\w+ ---- the rex is matching for any word character, once or more.
\S+ ---- not white space, once or more
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/159233-source-rex.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206085#M59956</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-09-29T11:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206086#M59957</link>
      <description>&lt;P&gt;To extract /Folder1/Folder2/Folder3/Folder4/Folder5/LoadABCDEF_20160921.log Try this:&lt;BR /&gt;
| rex field=source "(?[A-Za-z]+_[0-9]+).log"&lt;BR /&gt;
it will only extract the last filename as long as it is written in "alphabet_numeric.log" format&lt;/P&gt;

&lt;P&gt;To extract /Folder1/Folder2/Folder3/OrderOnline_ABCD/Folder4/ path try this:&lt;BR /&gt;
| rex field=source "(?[A-Za-z]+_[A-Za-z]+)"&lt;BR /&gt;
it will extract only the folder with "alphabet_alphabet" format&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:07:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206086#M59957</guid>
      <dc:creator>haley_swarnapat</dc:creator>
      <dc:date>2020-09-29T11:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206087#M59958</link>
      <description>&lt;P&gt;after the question mark "?", you need to add the  or &amp;lt;output&amp;gt; field&lt;BR /&gt;
I don't know why I can't type those "angle bracket"  in the answer like &amp;lt;&amp;gt; or &amp;lt;&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 10:22:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206087#M59958</guid>
      <dc:creator>haley_swarnapat</dc:creator>
      <dc:date>2016-09-22T10:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206088#M59959</link>
      <description>&lt;P&gt;Thank you for the quich response.&lt;BR /&gt;
For below&lt;BR /&gt;
/Folder1/Folder2/Folder3/OrderOnline_ABCD/Folder4/ path&lt;BR /&gt;
I would like to fetch "OrderOnline_ABCD" from the source.&lt;BR /&gt;
 | rex field=source "\/(?\w+_\w+)\/" | table sourceRex&lt;/P&gt;

&lt;P&gt;its giving sourceRex value as Folder3. Can u please elaborate how its working?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:04:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206088#M59959</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2020-09-29T11:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206089#M59960</link>
      <description>&lt;P&gt;actually Folder3 is like Folder_3. is it breaking there?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 11:13:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206089#M59960</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2016-09-22T11:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206090#M59961</link>
      <description>&lt;P&gt;exactly, yes, if folder3 is having an underscore, then, please check - &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex field=source "\/(?\w+\_\w+)\/w+\/" | table sourceRex&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 11:33:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206090#M59961</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-09-22T11:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206091#M59962</link>
      <description>&lt;P&gt;How to give 0 or 1 condition for "&lt;EM&gt;"? "&lt;/EM&gt;" may or may not be there in the path.&lt;BR /&gt;
Like "OrderOnline_ABCD" may have "OrderOnlineABCD" value. this value is gettimg ignored.&lt;BR /&gt;
[0|1] OR [0,1] doesn't work here? \/(?\w+[0|1]_\w+)\/w+\/ its is not working. Kindly help&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:24:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206091#M59962</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2016-09-23T06:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206092#M59963</link>
      <description>&lt;P&gt;How to ignore  "_" in tha path. Few \/(?\w+[0|1]_\w+)\/w+\/ kind is not working. Please help me with that. Because value can be "OrderOnline_ABCD" or "OrderOnlineABCD". the current rex is ignoring "OrderOnlineABCD"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:05:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206092#M59963</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2020-09-29T11:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206093#M59964</link>
      <description>&lt;P&gt;Pls try the updated query on the answer..&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206093#M59964</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-09-23T06:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206094#M59965</link>
      <description>&lt;P&gt;To extract /Folder1/Folder2/Folder3/Folder4/Folder5/LoadABCDEF_20160921.log Try this:&lt;BR /&gt;
| rex field=source "(?[A-Za-z]+_[0-9]+).log"&lt;BR /&gt;
it will only extract the last filename as long as it is written in "alphabet_numeric.log" format&lt;/P&gt;

&lt;P&gt;This is definitely working. But how to ignore displaying of  date format after "&lt;EM&gt;"?I want to display only "LoadABCDEF". and ther is one more "&lt;/EM&gt;" inbetween the path like Folder_3.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:05:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206094#M59965</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2020-09-29T11:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206095#M59966</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;P&gt;| rex field=source "(\/\w+){3}\/(?&amp;lt;rexOutput&amp;gt;\w+)\S+" | table rexOutput&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:50:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206095#M59966</guid>
      <dc:creator>haley_swarnapat</dc:creator>
      <dc:date>2016-09-23T06:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206096#M59967</link>
      <description>&lt;P&gt;I did not get. Can you please send it again?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:54:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206096#M59967</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2016-09-23T06:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206097#M59968</link>
      <description>&lt;P&gt;It worked perfectly. Thank you so much&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 07:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206097#M59968</guid>
      <dc:creator>priyankamundarg</dc:creator>
      <dc:date>2016-09-23T07:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206098#M59969</link>
      <description>&lt;P&gt;+1...&lt;BR /&gt;
Good one, Haley Swarnapati. &lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 08:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206098#M59969</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-09-23T08:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206099#M59970</link>
      <description>&lt;P&gt;@priyankamundargi, please check this quick ref guide on page 6, &lt;BR /&gt;
&lt;A href="https://www.splunk.com/content/dam/splunk2/pdfs/solution-guides/splunk-quick-reference-guide.pdf"&gt;https://www.splunk.com/content/dam/splunk2/pdfs/solution-guides/splunk-quick-reference-guide.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 08:18:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206099#M59970</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-09-23T08:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rex for Source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206100#M59971</link>
      <description>&lt;P&gt;To extract "LoadABCDEF" from /Folder1/Folder2/Folder3/Folder4/Folder5/LoadABCDEF_20160921.log:&lt;/P&gt;

&lt;P&gt;| rex field=source "(\/\w+){5}\/(?&amp;lt;rexOutput&amp;gt;[A-Za-z0-9]+).*" | table rexOutput&lt;/P&gt;

&lt;P&gt;To extract "Folder3":&lt;BR /&gt;
| rex field=source "(\/\w+){2}\/(?&amp;lt;rexOutput&amp;gt;[^\/]+).*" | table rexOutput&lt;/P&gt;

&lt;P&gt;It wil work regardless how many symbol you put in folder3 you can test with "F-old(er)_3$%"&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 08:39:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-for-Source/m-p/206100#M59971</guid>
      <dc:creator>haley_swarnapat</dc:creator>
      <dc:date>2016-09-23T08:39:47Z</dc:date>
    </item>
  </channel>
</rss>

