<?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 How to combine multiple searches into 1 related table/graph? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346818#M160680</link>
    <description>&lt;P&gt;I have two searches something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"ns=my_project" message="*RESPONSE_CODE=200*" OR "*RESPONSE_CODE=400*" METHOD=API1 add|top RESPONSE_CODE
"ns=my_project" message="*RESPONSE_CODE=200*" OR "*RESPONSE_CODE=400*" METHOD=API2 something_else|top RESPONSE_CODE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to combine them into one graph/table that will look something like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3066i2A4D04AEBBF1D65C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Any help or ideas are greatly appreciated!&lt;BR /&gt;
Thanks. &lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2017 02:20:46 GMT</pubDate>
    <dc:creator>lordhans</dc:creator>
    <dc:date>2017-06-15T02:20:46Z</dc:date>
    <item>
      <title>How to combine multiple searches into 1 related table/graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346818#M160680</link>
      <description>&lt;P&gt;I have two searches something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"ns=my_project" message="*RESPONSE_CODE=200*" OR "*RESPONSE_CODE=400*" METHOD=API1 add|top RESPONSE_CODE
"ns=my_project" message="*RESPONSE_CODE=200*" OR "*RESPONSE_CODE=400*" METHOD=API2 something_else|top RESPONSE_CODE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to combine them into one graph/table that will look something like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3066i2A4D04AEBBF1D65C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Any help or ideas are greatly appreciated!&lt;BR /&gt;
Thanks. &lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 02:20:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346818#M160680</guid>
      <dc:creator>lordhans</dc:creator>
      <dc:date>2017-06-15T02:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine multiple searches into 1 related table/graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346819#M160681</link>
      <description>&lt;P&gt;start with this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo "ns=my_project" 
(message="*RESPONSE_CODE=200*" OR message="*RESPONSE_CODE=400*")
((METHOD="API1" and "add") OR (METHOD="API2" and "something_else"))
| stats count as eventcount by METHOD RESPONSE_CODE
| chart sum(eventcount) by METHOD RESPONSE_CODE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above code has not used the &lt;CODE&gt;top&lt;/CODE&gt; command to limit the responses, but if you only have 2 response codes, then &lt;CODE&gt;top&lt;/CODE&gt; is redundant.&lt;/P&gt;

&lt;P&gt;Here's a run-anywhere sample to show how it works...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval METHOD="API1 API2 API3" | makemv METHOD | mvexpand METHOD
| eval RESPONSE_CODE="200 400" | makemv RESPONSE_CODE| mvexpand RESPONSE_CODE
| eval rand=random()%155
| rename COMMENT as "The above just generates test data."

| stats sum(rand) as eventcount by METHOD RESPONSE_CODE
| chart sum(eventcount) by METHOD RESPONSE_CODE
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:05:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346819#M160681</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-15T20:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine multiple searches into 1 related table/graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346820#M160682</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YourIndexHere sourcetype=YourSourcetypeHere "ns=my_project" message="*RESPONSE_CODE=200*" OR "*RESPONSE_CODE=400*" ((METHOD="API1" AND "add") OR (METHOD="API2" AND "something_else")
| stats count(eval(searchmatch(message="*RESPONSE_CODE=200*"))) AS "Response 200" count(eval(searchmatch(message="*RESPONSE_CODE=400*"))) AS "Response 400" BYMETHOD
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 23:56:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-multiple-searches-into-1-related-table-graph/m-p/346820#M160682</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-15T23:56:41Z</dc:date>
    </item>
  </channel>
</rss>

