<?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 do I search using an evaluated numeric field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182919#M52666</link>
    <description>&lt;P&gt;Nope its not working . Do you know why. I need this for some other requirement.&lt;/P&gt;

&lt;P&gt;index=xyz event="NEAT-IN" platform=apns   |eval epochT=relative_time(now(), "-3d@d") | eval day=tonumber(strftime(epochT,"%d")) |eval nDay=tonumber(date_mday)| fields nDay,day,*|search nDay=day&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:37:46 GMT</pubDate>
    <dc:creator>arungeorge09</dc:creator>
    <dc:date>2020-09-28T18:37:46Z</dc:date>
    <item>
      <title>How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182913#M52660</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; index=xxx event="NEAT-IN" platform=apns   |eval epochT=relative_time(now(), "-2d@d") | eval day= strftime(epochT,"%d") | eval month=strftime(epochT,"%m")| eval year=strftime(epochT,"%Y") |fields day,*| search date_mday=day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This search is not working as expected. If I list the results I can see 11,11 for table date_mday,day .&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182913#M52660</guid>
      <dc:creator>arungeorge09</dc:creator>
      <dc:date>2015-01-13T18:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182914#M52661</link>
      <description>&lt;P&gt;Anybody knows how do I do this. This is very simple query but simply not working.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:48:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182914#M52661</guid>
      <dc:creator>arungeorge09</dc:creator>
      <dc:date>2015-01-13T18:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182915#M52662</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxx event="NEAT-IN" platform=apns [| gentimes start=-1 | eval date_mday=tonumber(strftime(relative_time(now(), "-2d@d"),"%d"))  | table date_mday ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:55:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182915#M52662</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-13T18:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182916#M52663</link>
      <description>&lt;P&gt;I have already a field called date_mday . I just need to match it. Here is my problem.&lt;/P&gt;

&lt;P&gt;Following is my data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 12/13/14 10:23:17.489 AM &amp;lt;167&amp;gt;1 2014-12-12T21:53:17.489-07:00 x.y.com neat 6627 apns [meta@28281 sequenceId="70840" sysUpTime="1093867625"][analytics@28281 event="NEAT-IN" platform="APNS"] {"timestamp":"1418446397487","platform":"apns","alertId":"142900204","appId":"appId","args":{},"deviceToken":"devToen","alert":"Message"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see I can't rely on _time as this is different and hence my dashboard queries with earliest=-1d@d is wrong. I instead want _time to be the time stamp after     '&amp;lt;167&amp;gt; 1'. How do I do that. So my solution was to use the parsed fields date_mday which actually represents this second timestamp and match with current time and then use this inside dashboard query.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182916#M52663</guid>
      <dc:creator>arungeorge09</dc:creator>
      <dc:date>2020-09-28T18:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182917#M52664</link>
      <description>&lt;P&gt;This is working man yes. I need to still understand what is being done here and why the simple query is not. what is gentimes . why  a subquery required&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 19:26:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182917#M52664</guid>
      <dc:creator>arungeorge09</dc:creator>
      <dc:date>2015-01-13T19:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182918#M52665</link>
      <description>&lt;P&gt;The gentimes is just a command to generate a row without hitting any index. You can use "| gentimes start=-1" OR "| stats count" to generate single row which will be used to define filters via subsearch.&lt;/P&gt;

&lt;P&gt;For writing optimum searches, all the filters should be moved to the right (as close to base search) if possible. The simple query you wrote is doing lot of eval calculations for all the rows and then applying filter, whereas the subsearch will just get evaluation once (before the base search) and its return values (which will be "date_mday=value") is replaced in base search, providing optimum filtering.&lt;/P&gt;

&lt;P&gt;In your search, I believe you're missing the conversion of "day" to number, (date_mday is number), as day is output of strftime command which will be string.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 19:47:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182918#M52665</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-13T19:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search using an evaluated numeric field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182919#M52666</link>
      <description>&lt;P&gt;Nope its not working . Do you know why. I need this for some other requirement.&lt;/P&gt;

&lt;P&gt;index=xyz event="NEAT-IN" platform=apns   |eval epochT=relative_time(now(), "-3d@d") | eval day=tonumber(strftime(epochT,"%d")) |eval nDay=tonumber(date_mday)| fields nDay,day,*|search nDay=day&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-using-an-evaluated-numeric-field/m-p/182919#M52666</guid>
      <dc:creator>arungeorge09</dc:creator>
      <dc:date>2020-09-28T18:37:46Z</dc:date>
    </item>
  </channel>
</rss>

