<?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: Eval Question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27978#M5486</link>
    <description>&lt;P&gt;In general you can look for relationships between fields with the where command, such as this:&lt;BR /&gt;&lt;BR /&gt;
some search | where abs(a - b) &amp;lt; 5000&lt;BR /&gt;&lt;BR /&gt;
That would filter out any event where the difference between field a and b isn't less than 5000.&lt;/P&gt;

&lt;P&gt;In order to do that in your case you need two _time fields, I fear in a simple join they might be muddled together in _time / one might get lost. Have you tried renaming the _time field in the second search before joining, say to time2? Doing a where on the difference between _time and time2 may yield your desired result.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Nov 2012 15:35:17 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2012-11-08T15:35:17Z</dc:date>
    <item>
      <title>Eval Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27977#M5485</link>
      <description>&lt;P&gt;I am trying to translate a user, to an external IP address and be accurate within 5 seconds. I have to do this using two different searches and two different sourcetypes.&lt;/P&gt;

&lt;P&gt;I am specifically looking for the 5 second "time check" of one searches timestamps, to the other's for accuracy, and I was thinking that the "eval" command would be the best for it but i'm not sure. I would like Splunk to compare the two searches timestamps, and return only the results that are within a 5 second window of the first searches time stamps. &lt;/P&gt;

&lt;P&gt;This is the current search&lt;/P&gt;

&lt;P&gt;sourcetype=qds eventtype="myevent" host="machine" | join int_port[search sourcetype=net "connection"] | table _time,user,domain,user_ip,ext_ip&lt;/P&gt;

&lt;P&gt;Is "eval" the best function to use here? &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:46:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27977#M5485</guid>
      <dc:creator>tmarlette</dc:creator>
      <dc:date>2020-09-28T12:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27978#M5486</link>
      <description>&lt;P&gt;In general you can look for relationships between fields with the where command, such as this:&lt;BR /&gt;&lt;BR /&gt;
some search | where abs(a - b) &amp;lt; 5000&lt;BR /&gt;&lt;BR /&gt;
That would filter out any event where the difference between field a and b isn't less than 5000.&lt;/P&gt;

&lt;P&gt;In order to do that in your case you need two _time fields, I fear in a simple join they might be muddled together in _time / one might get lost. Have you tried renaming the _time field in the second search before joining, say to time2? Doing a where on the difference between _time and time2 may yield your desired result.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2012 15:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27978#M5486</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-11-08T15:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27979#M5487</link>
      <description>&lt;P&gt;i just tried this, and it didn't work. the "where" command seems to be using integers. for instance &lt;/P&gt;

&lt;P&gt;some search | where time2-time1 &amp;lt; 5&lt;/P&gt;

&lt;P&gt;I think splunk sees the 5 as an integer, not seconds, and adding the 's' confuses splunk.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2012 16:32:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27979#M5487</guid>
      <dc:creator>tmarlette</dc:creator>
      <dc:date>2012-11-08T16:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27980#M5488</link>
      <description>&lt;P&gt;Try grouping the arithmetic with ( ) in your where command: &lt;CODE&gt;where ((time2-time1) &amp;lt; 5)&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;When I've needed to do this before, I've used &lt;CODE&gt;eval&lt;/CODE&gt; to create a "delta" field, representing the difference between two time values, then using a search / where to filter for delta over a certain threshold.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2012 17:33:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27980#M5488</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-11-08T17:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27981#M5489</link>
      <description>&lt;P&gt;Additionally, don't forget to apply the abs() function in case time1 is larger than time2.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2012 18:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27981#M5489</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2012-11-08T18:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27982#M5490</link>
      <description>&lt;P&gt;The answer to this question was to use the "transaction" function. &lt;/P&gt;

&lt;P&gt;Here was the section that solved it: &lt;BR /&gt;
transaction int_port startswith="some log part" endswith="some other log part" maxspan=10s&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2012 17:27:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Question/m-p/27982#M5490</guid>
      <dc:creator>tmarlette</dc:creator>
      <dc:date>2012-11-28T17:27:29Z</dc:date>
    </item>
  </channel>
</rss>

