<?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 Combine 2 Splunk queries in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54250#M13250</link>
    <description>&lt;P&gt;I have 2 splunk searches:&lt;/P&gt;

&lt;P&gt;First:&lt;/P&gt;

&lt;P&gt;This extracts whats the URLs in column 10 and unique counts the URLs&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=hwa_other source=/var/tomcat/servers/HAP01/logs/tomcat_access*.log | rex field=_raw "(?i)^(?:[^ ]* ){10}(?P&amp;lt;URL&amp;gt;[^ ]+)" | stats count by URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Second:&lt;/P&gt;

&lt;P&gt;This counts the occurences of dealswidget or hotelquerywidget&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=hwa_other source=/var/tomcat/servers/HAP01/logs/tomcat_access*.log "dealswidget" OR "hotelquerywidget" | rex "(?&amp;lt;myword&amp;gt;dealswidget|hotelquerywidget)" | stats count by myword
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i would like to combine the two serches so that i get a count of dealswidget" OR hotelquerywidget (from the second search) and then a count of unique URLs (from the first search).&lt;/P&gt;

&lt;P&gt;Any ideas? Simply piping one search to the other dont work.&lt;/P&gt;

&lt;P&gt;Thanks for the assitance. &lt;/P&gt;</description>
    <pubDate>Fri, 05 Aug 2011 16:10:29 GMT</pubDate>
    <dc:creator>nishil</dc:creator>
    <dc:date>2011-08-05T16:10:29Z</dc:date>
    <item>
      <title>Combine 2 Splunk queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54250#M13250</link>
      <description>&lt;P&gt;I have 2 splunk searches:&lt;/P&gt;

&lt;P&gt;First:&lt;/P&gt;

&lt;P&gt;This extracts whats the URLs in column 10 and unique counts the URLs&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=hwa_other source=/var/tomcat/servers/HAP01/logs/tomcat_access*.log | rex field=_raw "(?i)^(?:[^ ]* ){10}(?P&amp;lt;URL&amp;gt;[^ ]+)" | stats count by URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Second:&lt;/P&gt;

&lt;P&gt;This counts the occurences of dealswidget or hotelquerywidget&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=hwa_other source=/var/tomcat/servers/HAP01/logs/tomcat_access*.log "dealswidget" OR "hotelquerywidget" | rex "(?&amp;lt;myword&amp;gt;dealswidget|hotelquerywidget)" | stats count by myword
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now i would like to combine the two serches so that i get a count of dealswidget" OR hotelquerywidget (from the second search) and then a count of unique URLs (from the first search).&lt;/P&gt;

&lt;P&gt;Any ideas? Simply piping one search to the other dont work.&lt;/P&gt;

&lt;P&gt;Thanks for the assitance. &lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2011 16:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54250#M13250</guid>
      <dc:creator>nishil</dc:creator>
      <dc:date>2011-08-05T16:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Combine 2 Splunk queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54251#M13251</link>
      <description>&lt;P&gt;You can use the append search command as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..... | stats count BY URL | append [..... | stats count BY myword]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Aug 2011 21:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54251#M13251</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2011-08-05T21:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Combine 2 Splunk queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54252#M13252</link>
      <description>&lt;P&gt;I'm not completly sure I understand what you are asking for, but I have an idea. If I miss, post a mocked up example of what you expect your results table to look like.&lt;/P&gt;

&lt;P&gt;I think you are looking for the "append" search command.&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=hwa_other source=/var/tomcat/servers/HAP01/logs/tomcat_access*.log "dealswidget" OR "hotelquerywidget" | rex "(?&amp;lt;myword&amp;gt;dealswidget|hotelquerywidget)" | stats count by myword | append [sourcetype=hwa_other source=/var/tomcat/servers/HAP01/logs/tomcat_access.log | rex field=_raw "(?i)^(?:[^ ] ){10}(?P&amp;lt;url&amp;gt;[^ ]+)" | stats count by URL]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Aug 2011 21:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54252#M13252</guid>
      <dc:creator>jrwilk01</dc:creator>
      <dc:date>2011-08-05T21:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Combine 2 Splunk queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54253#M13253</link>
      <description>&lt;P&gt;When the prefix query ( .....) is long, is there a way to assign that to an identifier so it can be referenced more than once?  &lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 16:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-2-Splunk-queries/m-p/54253#M13253</guid>
      <dc:creator>alancalvitti</dc:creator>
      <dc:date>2019-07-02T16:05:27Z</dc:date>
    </item>
  </channel>
</rss>

