<?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 sum two fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606331#M210877</link>
    <description>&lt;P&gt;excellent, thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2022 12:09:57 GMT</pubDate>
    <dc:creator>vince_iw</dc:creator>
    <dc:date>2022-07-20T12:09:57Z</dc:date>
    <item>
      <title>How to sum two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606323#M210875</link>
      <description>&lt;P&gt;I am attempting to eval a new field, from two other fields:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval 4XXError=if(metric_name="4XXError", statistic_value, null()) 
| eval 5XXError=if(metric_name="5XXError", statistic_value, null()) 
| eval total_errors='4XXError'+'5XXError'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I come to stat them out:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| stats last(4XXError), last(5XXError), last(total_errors) by api_name, http_method, url&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the total_errors column is just blank:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vince_iw_0-1658315465525.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20601i656CA3832B8C8388/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vince_iw_0-1658315465525.png" alt="vince_iw_0-1658315465525.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;vince_iw_0-1658315465525.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where am i going wrong?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;also why does 4XXError need to be single-quoted? is it because it starts with a number?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606323#M210875</guid>
      <dc:creator>vince_iw</dc:creator>
      <dc:date>2022-07-20T14:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to sum two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606326#M210876</link>
      <description>&lt;P&gt;Try it like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval 4XXError=if(metric_name="4XXError", statistic_value, null()) 
| eval 5XXError=if(metric_name="5XXError", statistic_value, null()) 
| stats last(4XXError) as 4XXError, last(5XXError) as 5XXError by api_name, http_method, url
| eval total_errors='4XXError'+'5XXError'&lt;/LI-CODE&gt;&lt;P&gt;You search seems to imply that the 4XXError (stats) events are different events to the 5XXError, so you need to use stats by ... to gather them into single events so you can do the arithmetic&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 11:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606326#M210876</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-20T11:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to sum two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606331#M210877</link>
      <description>&lt;P&gt;excellent, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 12:09:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sum-two-fields/m-p/606331#M210877</guid>
      <dc:creator>vince_iw</dc:creator>
      <dc:date>2022-07-20T12:09:57Z</dc:date>
    </item>
  </channel>
</rss>

