<?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 get result for device grouped by two different fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-result-for-device-grouped-by-two-different-fields/m-p/112311#M183744</link>
    <description>&lt;P&gt;I have the following scenario:&lt;/P&gt;

&lt;P&gt;x number of devices connected to 8 different nodes. The 8 nodes are connected to 3 switches.  What I'm trying to do is generate a report that will show me the number of nodes that have device failures broken down by switch.  I can generate a report that shows me the device failure by node but can't figure out how to get nodes with device failures broken down by switch. &lt;/P&gt;

&lt;P&gt;The following search string allows me to get the device (STB) failure count by node (NodeName):&lt;/P&gt;

&lt;P&gt;| eval foo=if(stb_fail==0, 0, 1)&lt;BR /&gt;
| stats sum(foo) AS TotalBox by NodeName&lt;BR /&gt;
| eval fooNode=case(TotalBox==1,"1", TotalBox==2,"2",TotalBox&amp;gt;2,"&amp;gt;2")&lt;BR /&gt;
| stats count by fooNode &lt;/P&gt;

&lt;P&gt;I have a field called NodeName as well as another called SwitchName and have a table with values for both these fields.  Hope my question is clear.  Appreciate any assistance offered.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Sep 2014 04:16:54 GMT</pubDate>
    <dc:creator>hcastell</dc:creator>
    <dc:date>2014-09-05T04:16:54Z</dc:date>
    <item>
      <title>How to get result for device grouped by two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-result-for-device-grouped-by-two-different-fields/m-p/112311#M183744</link>
      <description>&lt;P&gt;I have the following scenario:&lt;/P&gt;

&lt;P&gt;x number of devices connected to 8 different nodes. The 8 nodes are connected to 3 switches.  What I'm trying to do is generate a report that will show me the number of nodes that have device failures broken down by switch.  I can generate a report that shows me the device failure by node but can't figure out how to get nodes with device failures broken down by switch. &lt;/P&gt;

&lt;P&gt;The following search string allows me to get the device (STB) failure count by node (NodeName):&lt;/P&gt;

&lt;P&gt;| eval foo=if(stb_fail==0, 0, 1)&lt;BR /&gt;
| stats sum(foo) AS TotalBox by NodeName&lt;BR /&gt;
| eval fooNode=case(TotalBox==1,"1", TotalBox==2,"2",TotalBox&amp;gt;2,"&amp;gt;2")&lt;BR /&gt;
| stats count by fooNode &lt;/P&gt;

&lt;P&gt;I have a field called NodeName as well as another called SwitchName and have a table with values for both these fields.  Hope my question is clear.  Appreciate any assistance offered.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 04:16:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-result-for-device-grouped-by-two-different-fields/m-p/112311#M183744</guid>
      <dc:creator>hcastell</dc:creator>
      <dc:date>2014-09-05T04:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get result for device grouped by two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-result-for-device-grouped-by-two-different-fields/m-p/112312#M183745</link>
      <description>&lt;P&gt;Hi hcastell,&lt;/P&gt;

&lt;P&gt;if I get this correct you should be able to use something like this run everywhere command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal  source=*metrics.log | stats count(sourcetype) AS c_st by series
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you adapt it to your needs it would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here
| eval foo=if(stb_fail==0, 0, 1)
| stats sum(foo) AS TotalBox by NodeName
| eval fooNode=case(TotalBox==1,"1", TotalBox==2,"2",TotalBox&amp;gt;2,"&amp;gt;2")
| stats count(fooNode) by SwitchName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 05:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-result-for-device-grouped-by-two-different-fields/m-p/112312#M183745</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-09-05T05:40:26Z</dc:date>
    </item>
  </channel>
</rss>

