<?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: Field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478577#M134205</link>
    <description>&lt;P&gt;Hi sandeepmakkena,&lt;/P&gt;

&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search here
| rex field=src "buy-(?&amp;lt;family&amp;gt;[^\/]+)\/(?&amp;lt;product&amp;gt;.+)$"
| more SPL here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will return a field called &lt;CODE&gt;family&lt;/CODE&gt; and &lt;CODE&gt;product&lt;/CODE&gt; with values of &lt;CODE&gt;laptop&lt;/CODE&gt; or &lt;CODE&gt;mobile&lt;/CODE&gt; respectively &lt;CODE&gt;dell-200&lt;/CODE&gt; or &lt;CODE&gt;LG-i20&lt;/CODE&gt; based on your provided sample events.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2019 19:49:37 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2019-09-09T19:49:37Z</dc:date>
    <item>
      <title>Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478575#M134203</link>
      <description>&lt;P&gt;I have field in my raw events &lt;/P&gt;

&lt;P&gt;src = &lt;A href="https://www.abcd.com/shop/buy-laptop/dell-200"&gt;https://www.abcd.com/shop/buy-laptop/dell-200&lt;/A&gt;&lt;BR /&gt;
src= &lt;A href="https://www.abcd.com/shop/buy-mobile/LG-i20"&gt;https://www.abcd.com/shop/buy-mobile/LG-i20&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;I want to extract files product family and products. family like laptop, mobile and Products values like dell-200, LG-i20 &lt;/P&gt;

&lt;P&gt;Thanks for your time.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:59:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478575#M134203</guid>
      <dc:creator>sandeepmakkena</dc:creator>
      <dc:date>2019-09-09T18:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478576#M134204</link>
      <description>&lt;P&gt;Greetings @sandeepmakkena,&lt;/P&gt;

&lt;P&gt;Please try this run-anywhere search. Pick and choose the values you need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval src = "https://www.abcd.com/shop/buy-laptop/dell-200"
| append 
    [ | makeresults 
      | eval src= "https://www.abcd.com/shop/buy-mobile/LG-i20" ]
| rex field=src "(?&amp;lt;category&amp;gt;[^/]+)/[^/]+$"
| rex field=src "buy-(?&amp;lt;category_no_buy&amp;gt;[^/]+)/[^/]+$"
| rex field=src "(?&amp;lt;item&amp;gt;[^/]+)$"
| table src category_no_buy category item
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;src                                        category_no_buy   category      item
&lt;A href="https://www.abcd.com/shop/buy-laptop/dell-200" target="test_blank"&gt;https://www.abcd.com/shop/buy-laptop/dell-200&lt;/A&gt;    laptop      buy-laptop dell-200
&lt;A href="https://www.abcd.com/shop/buy-mobile/LG-i20" target="test_blank"&gt;https://www.abcd.com/shop/buy-mobile/LG-i20&lt;/A&gt;    mobile        buy-mobile LG-i20
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Sep 2019 19:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478576#M134204</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-09T19:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478577#M134205</link>
      <description>&lt;P&gt;Hi sandeepmakkena,&lt;/P&gt;

&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search here
| rex field=src "buy-(?&amp;lt;family&amp;gt;[^\/]+)\/(?&amp;lt;product&amp;gt;.+)$"
| more SPL here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will return a field called &lt;CODE&gt;family&lt;/CODE&gt; and &lt;CODE&gt;product&lt;/CODE&gt; with values of &lt;CODE&gt;laptop&lt;/CODE&gt; or &lt;CODE&gt;mobile&lt;/CODE&gt; respectively &lt;CODE&gt;dell-200&lt;/CODE&gt; or &lt;CODE&gt;LG-i20&lt;/CODE&gt; based on your provided sample events.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 19:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/478577#M134205</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-09-09T19:49:37Z</dc:date>
    </item>
  </channel>
</rss>

