<?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 Count total of 2 search terms and print unique results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51146#M12310</link>
    <description>&lt;P&gt;Hi! I'm pretty new to splunk and i'm trying to figure out how to:&lt;BR /&gt;
 1. Search for 2 different strings (dealswidget OR hotelquerywidget)&lt;BR /&gt;
 2. then total the occurences of the 2 strings&lt;BR /&gt;
 3. print the result for each of the strings&lt;/P&gt;

&lt;P&gt;Can anyone help please? &lt;/P&gt;

&lt;P&gt;The lines in the logs appear as:&lt;/P&gt;

&lt;P&gt;10.186.198.6 - - [29/Jul/2011:00:03:08 -0500] "GET /js/lib/jquery-1.5.js HTTP/1.0" 200 211978 "&lt;A href="http://partners.hotels.com/hotelquerywidget/1/1/HCOM_ES-es_ES/hotelquerywidget.html"&gt;http://partners.hotels.com/hotelquerywidget/1/1/HCOM_ES-es_ES/hotelquerywidget.html&lt;/A&gt;" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30" "5DC1789408E34ECF1A8F25E521617E9D.ut03hap01"&lt;/P&gt;

&lt;P&gt;10.186.198.6 - - [29/Jul/2011:00:09:04 -0500] "GET /styles/widget/hcom.external.common.css HTTP/1.1" 200 4255 "&lt;A href="http://partners.hotels.com/dealswidget/1/2/1633826/HCOM_NO-no_NO/widget.html"&gt;http://partners.hotels.com/dealswidget/1/2/1633826/HCOM_NO-no_NO/widget.html&lt;/A&gt;" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30" "3EDEC4AAE25F8C92260C2132409F54BC.ut03hap01"&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2011 13:14:11 GMT</pubDate>
    <dc:creator>nishil</dc:creator>
    <dc:date>2011-08-01T13:14:11Z</dc:date>
    <item>
      <title>Count total of 2 search terms and print unique results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51146#M12310</link>
      <description>&lt;P&gt;Hi! I'm pretty new to splunk and i'm trying to figure out how to:&lt;BR /&gt;
 1. Search for 2 different strings (dealswidget OR hotelquerywidget)&lt;BR /&gt;
 2. then total the occurences of the 2 strings&lt;BR /&gt;
 3. print the result for each of the strings&lt;/P&gt;

&lt;P&gt;Can anyone help please? &lt;/P&gt;

&lt;P&gt;The lines in the logs appear as:&lt;/P&gt;

&lt;P&gt;10.186.198.6 - - [29/Jul/2011:00:03:08 -0500] "GET /js/lib/jquery-1.5.js HTTP/1.0" 200 211978 "&lt;A href="http://partners.hotels.com/hotelquerywidget/1/1/HCOM_ES-es_ES/hotelquerywidget.html"&gt;http://partners.hotels.com/hotelquerywidget/1/1/HCOM_ES-es_ES/hotelquerywidget.html&lt;/A&gt;" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30" "5DC1789408E34ECF1A8F25E521617E9D.ut03hap01"&lt;/P&gt;

&lt;P&gt;10.186.198.6 - - [29/Jul/2011:00:09:04 -0500] "GET /styles/widget/hcom.external.common.css HTTP/1.1" 200 4255 "&lt;A href="http://partners.hotels.com/dealswidget/1/2/1633826/HCOM_NO-no_NO/widget.html"&gt;http://partners.hotels.com/dealswidget/1/2/1633826/HCOM_NO-no_NO/widget.html&lt;/A&gt;" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30" "3EDEC4AAE25F8C92260C2132409F54BC.ut03hap01"&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2011 13:14:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51146#M12310</guid>
      <dc:creator>nishil</dc:creator>
      <dc:date>2011-08-01T13:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count total of 2 search terms and print unique results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51147#M12311</link>
      <description>&lt;P&gt;I would first setup some type of field extraction for the webpage you are looking to report on. Then just run your search as follows&lt;/P&gt;

&lt;P&gt;index=myindex yourextractedfield=dealswidget OR yourextractedfield=hotelquerywidget | stats count by yourextractedfield&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2011 13:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51147#M12311</guid>
      <dc:creator>RicoSuave</dc:creator>
      <dc:date>2011-08-01T13:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Count total of 2 search terms and print unique results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51148#M12312</link>
      <description>&lt;P&gt;A quick and dirty way is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"dealswidget" OR "hotelquerywidget" 
| rex "(?&amp;lt;myword&amp;gt;dealswidget|hotelquerywidget)"
| stats count by myword
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Although you don't specify how to count if both words appear in an event, or if one word appears more than once.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2011 14:10:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51148#M12312</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-08-01T14:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count total of 2 search terms and print unique results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51149#M12313</link>
      <description>&lt;P&gt;Joetron's solution works - many thanks.&lt;BR /&gt;
It displays a count of the 2 strings i searched for. But how do i include the actual log lines in the results?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2011 10:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51149#M12313</guid>
      <dc:creator>nishil</dc:creator>
      <dc:date>2011-08-02T10:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count total of 2 search terms and print unique results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51150#M12314</link>
      <description>&lt;P&gt;add &lt;CODE&gt;values(_raw)&lt;/CODE&gt; in your stats command, like: "&lt;CODE&gt;| stats count,values(_raw) by yourextractedfield&lt;/CODE&gt;"&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2011 10:21:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-total-of-2-search-terms-and-print-unique-results/m-p/51150#M12314</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-08-02T10:21:58Z</dc:date>
    </item>
  </channel>
</rss>

