<?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 search all fieldA values where fieldB is a certain value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241312#M71754</link>
    <description>&lt;P&gt;We have a &lt;STRONG&gt;single source&lt;/STRONG&gt; with data (in table form) looking something like this:&lt;/P&gt;

&lt;TABLE&gt;&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH&gt;Name&lt;/TH&gt;
&lt;TH&gt;Position&lt;/TH&gt;
&lt;TH&gt;Department&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;&lt;TBODY&gt;
&lt;/TBODY&gt;&lt;/TABLE&gt;

&lt;PRE&gt;&lt;CODE&gt;John   Whatever    5
Jack   Boss        5
Jane   Particular  5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Multiple departments. Each department has one Boss.&lt;/P&gt;

&lt;P&gt;How to write a search to find out Names of bosses of everybody with a position of Particular?&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2016 20:23:15 GMT</pubDate>
    <dc:creator>pm771</dc:creator>
    <dc:date>2016-10-10T20:23:15Z</dc:date>
    <item>
      <title>How to search all fieldA values where fieldB is a certain value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241312#M71754</link>
      <description>&lt;P&gt;We have a &lt;STRONG&gt;single source&lt;/STRONG&gt; with data (in table form) looking something like this:&lt;/P&gt;

&lt;TABLE&gt;&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH&gt;Name&lt;/TH&gt;
&lt;TH&gt;Position&lt;/TH&gt;
&lt;TH&gt;Department&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;&lt;TBODY&gt;
&lt;/TBODY&gt;&lt;/TABLE&gt;

&lt;PRE&gt;&lt;CODE&gt;John   Whatever    5
Jack   Boss        5
Jane   Particular  5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Multiple departments. Each department has one Boss.&lt;/P&gt;

&lt;P&gt;How to write a search to find out Names of bosses of everybody with a position of Particular?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 20:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241312#M71754</guid>
      <dc:creator>pm771</dc:creator>
      <dc:date>2016-10-10T20:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to search all fieldA values where fieldB is a certain value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241313#M71755</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | table Name Position Department | eventstats values(eval(if(Position="Boss", Name, null()))) as Boss by Deptartment | where Position="Particular"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | table Name Position Department | eventstats values(eval(if(Position="Boss", Name, null()))) as Boss by Deptartment | eval Boss=if(Position="Particular", Boss, null())
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Oct 2016 20:38:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241313#M71755</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-10T20:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to search all fieldA values where fieldB is a certain value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241314#M71756</link>
      <description>&lt;P&gt;I'm confused.  Each department has its own Boss.  How do you relate Particulars to &lt;STRONG&gt;their&lt;/STRONG&gt; Bosses?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 20:55:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241314#M71756</guid>
      <dc:creator>pm771</dc:creator>
      <dc:date>2016-10-10T20:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to search all fieldA values where fieldB is a certain value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241315#M71757</link>
      <description>&lt;P&gt;I'll breakdown the second query....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats values(eval(if(Position="Boss", Name, null()))) as Boss by Deptartment | eval 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;eventstats&lt;/CODE&gt; command adds summary statistics to all search result. So what this query segment does, is it gets the &lt;CODE&gt;Name&lt;/CODE&gt; if &lt;CODE&gt;Position="Boss"&lt;/CODE&gt; and assigns it to a field called "Boss" for everyone in the (&lt;CODE&gt;by&lt;/CODE&gt;) Department. You can check this by removing the last segment. You should see the Department's Boss' name for each person in the Department. Is that not what you see?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Boss=if(Position="Particular", Boss, null())
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Just nulls out all Boss fields that do not have a corresponding "Position="Particular"&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/Eventstats"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/Eventstats&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 22:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241315#M71757</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-10T22:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to search all fieldA values where fieldB is a certain value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241316#M71758</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval BOSS=if((Position="Boss"), Name, null())
| stats values(BOSS) AS BOSS values(Position) AS Position BY Department
| search Position="Particular" | table BOSS
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Oct 2016 18:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-all-fieldA-values-where-fieldB-is-a-certain-value/m-p/241316#M71758</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-10-11T18:24:58Z</dc:date>
    </item>
  </channel>
</rss>

