<?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: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184404#M53118</link>
    <description>&lt;P&gt;Is there a way to search where two fields equal each other before the first pipe? &lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2019 22:17:09 GMT</pubDate>
    <dc:creator>algalvan</dc:creator>
    <dc:date>2019-10-01T22:17:09Z</dc:date>
    <item>
      <title>How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184392#M53106</link>
      <description>&lt;P&gt;Hi guys, &lt;/P&gt;

&lt;P&gt;So I need to figure out how to see if the thing from field ip_source equals the thing from field ip_destination and if it does, add the values of the two fields if the fields equal each other. Basically, I want the statistics to match up the items from each field and show their separate value and the values added together so that when I graph it in the visualization section there will be 3 different values (one for each field and one of the total of the 2 fields) for each ip address.&lt;/P&gt;

&lt;P&gt;The 2 fields are: ip_source, ip_destination&lt;BR /&gt;
They are in the same host and I am using all sources/sourcetypes (no specification)&lt;/P&gt;

&lt;P&gt;Please let me know if you can help!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:25:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184392#M53106</guid>
      <dc:creator>BITSIntern</dc:creator>
      <dc:date>2020-09-28T20:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184393#M53107</link>
      <description>&lt;P&gt;hi try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=... source=you_source sourcetype=you_sourcetype host=same_host| stats c(ip_source) as count_ip_source c(ip_destination) as count_ip_destination|where ip_source=ip_destination | eval total= count_ip_source + count_ip_destination | table ip_source count_ip_source ip_destination count_ip_destination total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:48:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184393#M53107</guid>
      <dc:creator>NOUMSSI</dc:creator>
      <dc:date>2015-06-30T15:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184394#M53108</link>
      <description>&lt;P&gt;I think this is what you need:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | chart count(ip_source) count(ip_destination) count(eval(ip_source==ip_destination)) AS count_src_is_dest
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:52:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184394#M53108</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T15:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184395#M53109</link>
      <description>&lt;P&gt;Hello! Try somethink like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=... source=... sourcetype=...| stats values(ip_source ) as ip_source values(ip_destination ) as ip_destination|join [search index=... source=... sourcetype=... ip_source =* ip_destination =*|where ip_source =ip_destination |eval sumip=ip_source + ip_destination |table sumip]|table ip_source  ip_destination sumip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=... source=... sourcetype=...ip_source =* ip_destination | eval sumip=case(ip_source =ip_destination ,ip_source +ip_destination )|stats values(ip_source ) as ip_source values(ip_destination ) as ip_dest values(sumip) as sumip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 16:06:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184395#M53109</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-30T16:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184396#M53110</link>
      <description>&lt;P&gt;It's weird, so far, none have resulted in any output besides woodcock's and his only returned a total for all of the addresses (only one thing returned)&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 16:11:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184396#M53110</guid>
      <dc:creator>BITSIntern</dc:creator>
      <dc:date>2015-06-30T16:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184397#M53111</link>
      <description>&lt;P&gt;The problem here is that you have definitely NOT been clear enough about what you desire.  I can think of 3 totally different ways to understand what you wrote.  It will REALLY help if you clarify with a more detailed example of data and desired results.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 16:26:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184397#M53111</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T16:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184398#M53112</link>
      <description>&lt;P&gt;Actually I think you are trying to get this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...  | eval SameOrDifferent=if(ip_destination==ip_source),"SAME","DIFFERENT") | eval bothIPs = ip_source . "," . ip_destintation | makemv delim="," bothIPs | stats count AS each count(eval(SameOrDifferent=="SAME")) AS both by bothIPs | eval both=both/2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 16:32:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184398#M53112</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T16:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184399#M53113</link>
      <description>&lt;P&gt;uhh ok.... So for my ip_source there are many different ip addresses that have been repeated and the same goes for ip_destination. I would like to create a search that counts the total of each ip address which a top/rare limit search already does but I would like it to also match up the ip_source if it is identical (the ip address not the amount of times it has been repeated) to the ip_destination. If they are equal, it will count the total of the 2 different fields ( the ip_source and ip_destination) such that the one ip address will have three values: the ip_source count, the ip_destination count, the total count. &lt;/P&gt;

&lt;P&gt;For mine, I don't have to specify the source/sourcetype, only the host.&lt;/P&gt;

&lt;P&gt;Sorry if I was unclear, I am extremely new to splunk.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:25:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184399#M53113</guid>
      <dc:creator>BITSIntern</dc:creator>
      <dc:date>2020-09-28T20:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184400#M53114</link>
      <description>&lt;P&gt;Based on your clarification, I think this will do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | where ip_destination=ip_source
| stats count AS both BY ip_source
| rename ip_source AS ip_address
| append [  ... | stats count AS source      BY ip_source      | rename ip_source      AS ip_address ]
| append [  ... | stats count AS destination BY ip_destination | rename ip_destination AS ip_address ]
| stats values(*) AS * by ip_address
| fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jul 2015 14:06:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184400#M53114</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-01T14:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184401#M53115</link>
      <description>&lt;P&gt;Thank you this really helped!! &lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 14:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184401#M53115</guid>
      <dc:creator>BITSIntern</dc:creator>
      <dc:date>2015-07-01T14:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184402#M53116</link>
      <description>&lt;P&gt;When you ask questions better, you get better answers!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 14:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184402#M53116</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-01T14:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184403#M53117</link>
      <description>&lt;P&gt;Sounds like you want to &lt;EM&gt;count&lt;/EM&gt; the number of times ip_source is equal to ip_destination.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184403#M53117</guid>
      <dc:creator>lancerkind</dc:creator>
      <dc:date>2020-09-29T22:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to search if a value from FieldA equals a value from FieldB, add the two values if true, and display both values with their sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184404#M53118</link>
      <description>&lt;P&gt;Is there a way to search where two fields equal each other before the first pipe? &lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 22:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-if-a-value-from-FieldA-equals-a-value-from-FieldB/m-p/184404#M53118</guid>
      <dc:creator>algalvan</dc:creator>
      <dc:date>2019-10-01T22:17:09Z</dc:date>
    </item>
  </channel>
</rss>

