<?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: Cannot sum two numbers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493969#M194474</link>
    <description>&lt;P&gt;It found the solution...I used instead of &lt;CODE&gt;append&lt;/CODE&gt; I used &lt;CODE&gt;join&lt;/CODE&gt; for the subsearch...and it worked!&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 08:20:58 GMT</pubDate>
    <dc:creator>veromihaiu</dc:creator>
    <dc:date>2019-10-10T08:20:58Z</dc:date>
    <item>
      <title>Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493963#M194468</link>
      <description>&lt;P&gt;I have the following problem: I have a variable "number_of_past_events" which comes from a &lt;STRONG&gt;"| inputlookup file.csv"&lt;/STRONG&gt; and another variable from a sub search " &lt;STRONG&gt;nr_events"&lt;/STRONG&gt;. When I try to create a new variable with the sum of these two variables like this: "&lt;STRONG&gt;|eval new_number_of_events=number_of_past_events+nr_events "&lt;/STRONG&gt; this new number does not have a value.  I tried to use table command like this "&lt;STRONG&gt;| table number_of_past_events, nr_events,new_number_of_events&lt;/STRONG&gt;" and the output shows the first two correctly but the new_number_of_events does not have a value. How can I resolve this problem?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:24:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493963#M194468</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2020-09-30T02:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493964#M194469</link>
      <description>&lt;P&gt;It might be beneficial to get a screenshot of your fields from the interesting fields screen, but it seems one (or both) of the field(s) are not number. You could use &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| convert num(wrongformatfield)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eval tonumber(wrongformatfield)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;More info here: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/convert"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/convert&lt;/A&gt; and here &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/convert"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/convert&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 10:37:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493964#M194469</guid>
      <dc:creator>gfreitas</dc:creator>
      <dc:date>2019-10-08T10:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493965#M194470</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;* LogName="Microsoft-Windows-PowerShell/Operational" earliest=-1000m latest=now
| search EventCode="4103" 
| chart 
count(eval(like(_raw,"%C:\Windows\system32\svchost.exe%"))) AS svchost_command  over _time span=20s 
| where (svchost_command&amp;gt;20) 
| eval message=if(svchost_command&amp;gt;20 ,"Detected","NOT DETECTED")
| append 
    [| inputlookup AvL_hist_test.csv ]
| append
    [search * LogName="Microsoft-Windows-PowerShell/Operational" earliest=-1000m latest=now
    | search EventCode="4103"
    | chart 
    count(eval(like(_raw,"%C:\Windows\system32\svchost.exe%"))) AS svchost_command  over _time span=20s
    | where (svchost_command&amp;gt;20) 
    | stats count(eval(svchost_command&amp;gt;20)) AS nr_events ]
| eval new_number_events=nr_events_history+nr_events
| table _time,message,nr_events_history,nr_events,new_number_events
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2019 11:27:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493965#M194470</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2019-10-08T11:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493966#M194471</link>
      <description>&lt;P&gt;This is my entire code. The output shows the nr_events_history and nr_events as numbers but the new_number_events does not have a value&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:24:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493966#M194471</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2020-09-30T02:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493967#M194472</link>
      <description>&lt;P&gt;try adding a &lt;CODE&gt;| fillnull&lt;/CODE&gt; to your outer and inner searches&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 15:03:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493967#M194472</guid>
      <dc:creator>wmyersas</dc:creator>
      <dc:date>2019-10-08T15:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493968#M194473</link>
      <description>&lt;P&gt;I don't see any fields nr_events_history before you used it on the last eval (on the penultimate line). That might be the case, no?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493968#M194473</guid>
      <dc:creator>gfreitas</dc:creator>
      <dc:date>2020-09-30T02:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493969#M194474</link>
      <description>&lt;P&gt;It found the solution...I used instead of &lt;CODE&gt;append&lt;/CODE&gt; I used &lt;CODE&gt;join&lt;/CODE&gt; for the subsearch...and it worked!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 08:20:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493969#M194474</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2019-10-10T08:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493970#M194475</link>
      <description>&lt;P&gt;Hi, so the reason that the numbers were not added wasn't the wrong format like we thought, it was that the two variables were not present in all events and the &lt;CODE&gt;append&lt;/CODE&gt; was an attempt to add the missing values to your events. In that case it makes perfect sense to use join instead as it adds values to existing events rather than additional events at the bottom of the list.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 08:34:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493970#M194475</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2019-10-10T08:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493971#M194476</link>
      <description>&lt;P&gt;Yes, you are right! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 08:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493971#M194476</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2019-10-10T08:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493972#M194477</link>
      <description>&lt;P&gt;nr_events_history comes from the| inputlookup AvL_hist_test.csv. I found the problem: I had to use &lt;CODE&gt;join&lt;/CODE&gt; instead of &lt;CODE&gt;append&lt;/CODE&gt; for the subsearch.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493972#M194477</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2020-09-30T02:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493973#M194478</link>
      <description>&lt;P&gt;I looked at your code another time. The first append loads your historic value and outputs the &lt;CODE&gt;nr_events_history&lt;/CODE&gt; field? If so, you could use a standard &lt;CODE&gt;lookup&lt;/CODE&gt; command instead of the join. It's much faster. The second append/join adds the total number of events that match &lt;CODE&gt;svchost_command&amp;gt;20&lt;/CODE&gt;? You could do the same with &lt;CODE&gt;eventstats&lt;/CODE&gt; only difference being: you would not run the same query twice. As a last suggestion for optimisation: remove the &lt;CODE&gt;if&lt;/CODE&gt; from the eval. The &lt;CODE&gt;where&lt;/CODE&gt; makes sure that all events are "Detected" anyway. So, &lt;CODE&gt;eval message="Detected "&lt;/CODE&gt; delivers the same result.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 08:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493973#M194478</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2019-10-10T08:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot sum two numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493974#M194479</link>
      <description>&lt;P&gt;Thank you for your suggestions! The response for your first question is yes, the first appends the historic value. The second adds the total number of events that matches svchost_command&amp;gt;20,yes. I will make the changes definitely! Thank you very much. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 09:04:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-sum-two-numbers/m-p/493974#M194479</guid>
      <dc:creator>veromihaiu</dc:creator>
      <dc:date>2019-10-10T09:04:04Z</dc:date>
    </item>
  </channel>
</rss>

