<?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: Sum of two fields from different searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657811#M227203</link>
    <description>&lt;P&gt;If&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.totalExportedProfileCounter) as Total_number_of_exported_profiles&lt;/LI-CODE&gt;&lt;P&gt;give you a result, and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.exportedRecords) as Total_number_of_exported_records&lt;/LI-CODE&gt;&lt;P&gt;also gives you a result, then&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.totalExportedProfileCounter) as Total_number_of_exported_profiles sum(message.exportedRecords) as Total_number_of_exported_records&lt;/LI-CODE&gt;&lt;P&gt;should give you two results which can be added together. Please recheck your searches.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Sep 2023 17:47:07 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-09-16T17:47:07Z</dc:date>
    <item>
      <title>How to get Sum of two fields from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657762#M227176</link>
      <description>&lt;P&gt;Hi -&lt;/P&gt;
&lt;P&gt;I would like to join and sum the results and output&lt;/P&gt;
&lt;P&gt;The searches:&lt;BR /&gt;&lt;BR /&gt;index=test_index sourcetype="test_source"&amp;nbsp; className=export | table message.totalExportedProfileCounter&lt;/P&gt;
&lt;P&gt;index=test_index sourcetype="test_source"&amp;nbsp; className=export | table message.exportedRecords&lt;/P&gt;
&lt;P&gt;From above both searches I am looking to add message.totalExportedProfileCounter, message.exportedRecords. For a given call only one of the above search shows up.&lt;/P&gt;
&lt;P&gt;I am looking for message.totalExportedProfileCounter +&amp;nbsp;message.exportedRecords&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 22:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657762#M227176</guid>
      <dc:creator>Techie</dc:creator>
      <dc:date>2023-09-18T22:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657797#M227194</link>
      <description>&lt;P&gt;Calculations can be done with fields in the same event.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| eval total = message.totalExportedProfileCounter + message.exportedRecords&lt;/LI-CODE&gt;&lt;P&gt;If these fields do not have values in the same event, you need to use something like stats to correlate different events into the same event. For this you need a common field value between events to correlate them by.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 07:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657797#M227194</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-16T07:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657806#M227200</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Thanks for the reply,&lt;/P&gt;&lt;P&gt;I tried below individually for getting sum of all records for each event type&lt;/P&gt;&lt;P&gt;index=test_index sourcetype="test_source"&amp;nbsp; className=export | stats sum(message.totalExportedProfileCounter) as Total_number_of_exported_profiles&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=test_index sourcetype="test_source"&amp;nbsp; className=export | stats sum(message.&lt;SPAN&gt;exportedRecords&lt;/SPAN&gt;) as Total_number_of_exported_profiles&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above queries run just fine by themselves but I am more interested to add both these results into one.&lt;BR /&gt;&lt;BR /&gt;Also the common field that you were asking for can be &lt;STRONG&gt;message.type=export_job&amp;nbsp;&lt;/STRONG&gt;which is available in both events.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 14:55:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657806#M227200</guid>
      <dc:creator>Techie</dc:creator>
      <dc:date>2023-09-16T14:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657807#M227201</link>
      <description>&lt;P&gt;Is this what you mean?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.totalExportedProfileCounter) as Total_number_of_exported_profiles sum(message.exportedRecords) as Total_number_of_exported_records
| eval total = Total_number_of_exported_profiles + Total_number_of_exported_records&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 16 Sep 2023 16:09:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657807#M227201</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-16T16:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657810#M227202</link>
      <description>&lt;P&gt;This is not helping.&lt;/P&gt;&lt;P&gt;Total_number_of_exported_profiles or Total_number_of_exported_records is showing up but not sum of them. See below screenshot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Techie_0-1694883207603.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27219iF70C05C923EAAD33/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Techie_0-1694883207603.png" alt="Techie_0-1694883207603.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 16:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657810#M227202</guid>
      <dc:creator>Techie</dc:creator>
      <dc:date>2023-09-16T16:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657811#M227203</link>
      <description>&lt;P&gt;If&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.totalExportedProfileCounter) as Total_number_of_exported_profiles&lt;/LI-CODE&gt;&lt;P&gt;give you a result, and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.exportedRecords) as Total_number_of_exported_records&lt;/LI-CODE&gt;&lt;P&gt;also gives you a result, then&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test_index sourcetype="test_source"  className=export
| stats sum(message.totalExportedProfileCounter) as Total_number_of_exported_profiles sum(message.exportedRecords) as Total_number_of_exported_records&lt;/LI-CODE&gt;&lt;P&gt;should give you two results which can be added together. Please recheck your searches.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 17:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657811#M227203</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-16T17:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657814#M227205</link>
      <description>&lt;P&gt;Looks like the final sum is not calculated when one of the results is empty. If both are available then the total is populated correctly. In my case either one of them is present. Any idea how to calculate sum in this case?&lt;/P&gt;&lt;P&gt;| eval total = Total_number_of_exported_profiles + Total_number_of_exported_records&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 22:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657814#M227205</guid>
      <dc:creator>Techie</dc:creator>
      <dc:date>2023-09-16T22:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657816#M227207</link>
      <description>&lt;LI-CODE lang="markup"&gt;| fillnull value=0 Total_number_of_exported_profiles Total_number_of_exported_records
| eval total = Total_number_of_exported_profiles + Total_number_of_exported_records&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 17 Sep 2023 08:16:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657816#M227207</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-17T08:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two fields from different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657900#M227241</link>
      <description>&lt;P&gt;This helped. Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 15:10:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-Sum-of-two-fields-from-different-searches/m-p/657900#M227241</guid>
      <dc:creator>Techie</dc:creator>
      <dc:date>2023-09-18T15:10:16Z</dc:date>
    </item>
  </channel>
</rss>

