<?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 Re: Splunk query to compare a particular field values in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658937#M17476</link>
    <description>&lt;P&gt;26,26,29 : 3 numbers are not equal &amp;nbsp;, so return results with 3rd number which is nor equal to other 2 .&amp;nbsp;&lt;/P&gt;&lt;P&gt;26,28,29: again 3 number are not equal , so return results with all 3&lt;/P&gt;&lt;P&gt;yes , it is always 3 number itself&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2023 06:03:00 GMT</pubDate>
    <dc:creator>harshi</dc:creator>
    <dc:date>2023-09-28T06:03:00Z</dc:date>
    <item>
      <title>Splunk query to compare a particular field values</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658829#M17455</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write a query which compare all field values for a particular field and fetch the results if its not same accordingly with its details. Below is my input :&lt;/P&gt;&lt;P&gt;FieldA&amp;nbsp; &amp;nbsp; FieldB&lt;/P&gt;&lt;P&gt;host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 26&lt;/P&gt;&lt;P&gt;host2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29&lt;/P&gt;&lt;P&gt;host3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29&lt;/P&gt;&lt;P&gt;I want to compare all field values from fieldB , and if its not same then i want to fetch that count with its fieldA value.&lt;/P&gt;&lt;P&gt;eg :&amp;nbsp; here 26 is not equal to other 2 field values , then fieldB value with fieldA values has to be displayed.&lt;/P&gt;&lt;P&gt;I tried with if condition&lt;/P&gt;&lt;P&gt;| eventstats list(fieldB) as counts | eval value1=mvindex(counts,-2)&amp;nbsp;| eval value2=mvindex(counts,-1) |&amp;nbsp;| eval value3=mvindex(counts,-0) | eval value=if(('value1'=='value2') AND ('value2'=='value3'),"0",""1")&lt;/P&gt;&lt;P&gt;Also with below query:&lt;/P&gt;&lt;P&gt;|stats dc(metric_value) as count | eval value=if(count&amp;gt;1,"0","1")&lt;/P&gt;&lt;P&gt;But with above 2 , i m not able pull its host name where that value is not same.&lt;/P&gt;&lt;P&gt;Note: fieldB is dynamic&lt;/P&gt;&lt;P&gt;Help me with this !!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 08:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658829#M17455</guid>
      <dc:creator>harshi</dc:creator>
      <dc:date>2023-09-27T08:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to compare a particular field values</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658834#M17457</link>
      <description>&lt;P&gt;If host1's 26 is not equal to the 29 values of host2 and host3, then what logic do you apply to host2, as its 29 is not equal to the value of host1's 26.&lt;/P&gt;&lt;P&gt;So effectively none of them are equal to all of the others - how do you know which one is the master value to compare against?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 08:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658834#M17457</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-27T08:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to compare a particular field values</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658836#M17458</link>
      <description>&lt;P&gt;If you are looking to find what values are not the maximum you could do this example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="FieldA    FieldB
host1        26
host2        29
host3        29" 
| multikv forceheader=1 
| table FieldA FieldB 
| eventstats dc(FieldB) as counts min(FieldB) as minFieldB max(FieldB) as maxFieldB
| eval result=if(counts&amp;gt;1 AND FieldB&amp;lt;maxFieldB, FieldA, null())
| stats list(eval(if(isnotnull(result), FieldA, null()))) as Hosts list(eval(if(isnotnull(result), FieldB, null()))) as Values&lt;/LI-CODE&gt;&lt;P&gt;to get a list of the hosts and their values that are not the maximum&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 09:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658836#M17458</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-27T09:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to compare a particular field values</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658858#M17465</link>
      <description>&lt;P&gt;There is no master , whatever the values which are present that should be same and not different.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 11:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658858#M17465</guid>
      <dc:creator>harshi</dc:creator>
      <dc:date>2023-09-27T11:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to compare a particular field values</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658914#M17474</link>
      <description>&lt;P&gt;What do you expect from 26,26,29 or 26,28,29?&lt;/P&gt;&lt;P&gt;Are there always only 3 numbers?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 22:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658914#M17474</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-27T22:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to compare a particular field values</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658937#M17476</link>
      <description>&lt;P&gt;26,26,29 : 3 numbers are not equal &amp;nbsp;, so return results with 3rd number which is nor equal to other 2 .&amp;nbsp;&lt;/P&gt;&lt;P&gt;26,28,29: again 3 number are not equal , so return results with all 3&lt;/P&gt;&lt;P&gt;yes , it is always 3 number itself&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 06:03:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-query-to-compare-a-particular-field-values/m-p/658937#M17476</guid>
      <dc:creator>harshi</dc:creator>
      <dc:date>2023-09-28T06:03:00Z</dc:date>
    </item>
  </channel>
</rss>

