<?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: Search for value in field after stripping characters in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165622#M47065</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test"  referrer="http://www.example.com/these-files/*" 
| rex field=referrer "(?&amp;lt;new_referrer&amp;gt;.*?)\?"
| stats count by new_referrer | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Apr 2015 16:53:08 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2015-04-24T16:53:08Z</dc:date>
    <item>
      <title>Search for value in field after stripping characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165620#M47063</link>
      <description>&lt;P&gt;Not sure how best to word the question but below is what I am trying to do - feel free to edit the question header.&lt;/P&gt;

&lt;P&gt;We have a list of URLs that are referrals:&lt;/P&gt;

&lt;P&gt;e.g.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.example.com/this-file/doe?a=a"&gt;www.example.com/this-file/doe?a=a&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.example.com/this-file/dane"&gt;www.example.com/this-file/dane&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.example.com/this-file/doe"&gt;www.example.com/this-file/doe&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;URL 1 and URL 3 are in actuality the same, there is just URL params in the first. Is there a method I Can use to strip the URL params before running the search an doing a count? The outcome would be ideally&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.example.com/this-file/doe"&gt;www.example.com/this-file/doe&lt;/A&gt; - 2&lt;BR /&gt;
&lt;A href="http://www.example.com/this-file/dane"&gt;www.example.com/this-file/dane&lt;/A&gt; - 1&lt;/P&gt;

&lt;P&gt;We cannot pre-filter the data using props or inputs.conf. This would have to be done at search run time.&lt;/P&gt;

&lt;P&gt;currently our search string is index="test"  regex referrer="^&lt;A href="http://www.example.com/these-files/*"&gt;http://www.example.com/these-files/*&lt;/A&gt;" | stats count by referrer | sort -count&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:44:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165620#M47063</guid>
      <dc:creator>akhanVG</dc:creator>
      <dc:date>2015-04-24T16:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search for value in field after stripping characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165621#M47064</link>
      <description>&lt;P&gt;have you try&lt;BR /&gt;
faup app:&lt;BR /&gt;
&lt;A href="https://splunkbase.splunk.com/app/1545/"&gt;https://splunkbase.splunk.com/app/1545/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;this my help you handling urls&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:50:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165621#M47064</guid>
      <dc:creator>aalanisr26</dc:creator>
      <dc:date>2015-04-24T16:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Search for value in field after stripping characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165622#M47065</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test"  referrer="http://www.example.com/these-files/*" 
| rex field=referrer "(?&amp;lt;new_referrer&amp;gt;.*?)\?"
| stats count by new_referrer | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165622#M47065</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-04-24T16:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search for value in field after stripping characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165623#M47066</link>
      <description>&lt;P&gt;Alternative would be to use regular expression:&lt;/P&gt;

&lt;P&gt;index="test" regex referrer="^&lt;A href="http://www.example.com/these-files/*"&gt;http://www.example.com/these-files/*&lt;/A&gt;" | rex field=referrer "(?.+)\?"&lt;BR /&gt;
stats count by url | sort -count&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:53:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165623#M47066</guid>
      <dc:creator>aalanisr26</dc:creator>
      <dc:date>2015-04-24T16:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search for value in field after stripping characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165624#M47067</link>
      <description>&lt;P&gt;Will definitely look into this. @lguinn answer did it for me so far though - thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:57:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-value-in-field-after-stripping-characters/m-p/165624#M47067</guid>
      <dc:creator>akhanVG</dc:creator>
      <dc:date>2015-04-24T16:57:12Z</dc:date>
    </item>
  </channel>
</rss>

