<?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: count the field using occurrences of string in the field value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525500#M148309</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227739"&gt;@goalkeeper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this demo example using your data&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="url,queryString
http://host/getOrder,id=1&amp;amp;id=2&amp;amp;id=3
http://host/getUser,id=1&amp;amp;id=2
http://host/getUser,id=2&amp;amp;id=3"
| multikv forceheader=1
| table url queryString
| rex field=queryString max_match=0 "id=(?&amp;lt;id&amp;gt;\d+)"
| eval ids=mvcount(id)
| stats sum(ids) as ids by url&lt;/LI-CODE&gt;&lt;P&gt;What you want is from the rex statement down. This will&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Extract the ids into a new field called id based on the regex&lt;/LI&gt;&lt;LI&gt;Count the number of ids found&lt;/LI&gt;&lt;LI&gt;Calculate the sum of ids by url&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Oct 2020 05:01:39 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2020-10-20T05:01:39Z</dc:date>
    <item>
      <title>count the field using occurrences of string in the field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525494#M148307</link>
      <description>&lt;P&gt;I am very new to Splunk.&lt;/P&gt;&lt;P&gt;I have an access.log file, which contains the Url and&amp;nbsp; querystring:&lt;/P&gt;&lt;P&gt;url&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;queryString&lt;/P&gt;&lt;P data-unlink="true"&gt;http://host/getOrder&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;id=1&amp;amp;id=2&amp;amp;id=3&lt;/P&gt;&lt;P data-unlink="true"&gt;http://host/getUser&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;id=1&amp;amp;id=2&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;http://host/getUser&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; id=2&amp;amp;id=3&amp;nbsp;&lt;/P&gt;&lt;P&gt;How could I&amp;nbsp; count the url using the occurrence of "id" in the queryString?&lt;/P&gt;&lt;P&gt;So the result I want would be&lt;/P&gt;&lt;P&gt;Url&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IdCount&lt;/P&gt;&lt;P&gt;&lt;A href="http://host/getOrder" target="_blank"&gt;http://host/getOrder&lt;/A&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&lt;A href="http://host/getUser" target="_blank"&gt;http://host/getUser&lt;/A&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 04:36:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525494#M148307</guid>
      <dc:creator>goalkeeper</dc:creator>
      <dc:date>2020-10-20T04:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: count the field using occurrences of string in the field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525500#M148309</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227739"&gt;@goalkeeper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this demo example using your data&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="url,queryString
http://host/getOrder,id=1&amp;amp;id=2&amp;amp;id=3
http://host/getUser,id=1&amp;amp;id=2
http://host/getUser,id=2&amp;amp;id=3"
| multikv forceheader=1
| table url queryString
| rex field=queryString max_match=0 "id=(?&amp;lt;id&amp;gt;\d+)"
| eval ids=mvcount(id)
| stats sum(ids) as ids by url&lt;/LI-CODE&gt;&lt;P&gt;What you want is from the rex statement down. This will&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Extract the ids into a new field called id based on the regex&lt;/LI&gt;&lt;LI&gt;Count the number of ids found&lt;/LI&gt;&lt;LI&gt;Calculate the sum of ids by url&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 05:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525500#M148309</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-10-20T05:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: count the field using occurrences of string in the field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525610#M148344</link>
      <description>&lt;P&gt;It works. Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 17:06:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-the-field-using-occurrences-of-string-in-the-field-value/m-p/525610#M148344</guid>
      <dc:creator>goalkeeper</dc:creator>
      <dc:date>2020-10-20T17:06:40Z</dc:date>
    </item>
  </channel>
</rss>

