<?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: Earliest_time and Latest_time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461337#M191386</link>
    <description>&lt;P&gt;Yes this is exactly what i say. &lt;BR /&gt;
I have to use from datamodel and not tstats any way. &lt;BR /&gt;
The most weird thing is that the original query does work on other system. &lt;/P&gt;</description>
    <pubDate>Sun, 25 Aug 2019 12:06:12 GMT</pubDate>
    <dc:creator>astatrial</dc:creator>
    <dc:date>2019-08-25T12:06:12Z</dc:date>
    <item>
      <title>Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461328#M191377</link>
      <description>&lt;P&gt;Hi all, &lt;BR /&gt;
I am trying to use Earliest_time and Latest_time in splunk query in order to simulate the REST API (running the query from the search), but for some reason it doesn't work with Data model.  With index="main" (without DM) it does work. &lt;BR /&gt;
I am &lt;BR /&gt;
Query that is working: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main"
| search src="ABC" app="win:unknown" earliest_time=-24h latest_time=now()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Query that is not working: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"Authentication"."Failed_Authentication" 
| search src="ABC" app="win:unknown" earliest_time=-24h latest_time=now()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By working i mean that the time range is showing 24h: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (8/24/19 11:18:13.000 AM to 8/25/19 11:18:13.000 AM)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/274485-timefield.png" alt="alt text" /&gt;&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/274484-datamodel.png" alt="alt text" /&gt;&lt;BR /&gt;
Thanks for the helpers!!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461328#M191377</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2020-09-30T01:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461329#M191378</link>
      <description>&lt;P&gt;| from datamodel:"Authentication"."Failed_Authentication" &lt;BR /&gt;
 | search src="ABC" app="win:unknown" earliest_time=-24h latest_time=now()|&lt;BR /&gt;
 where _time &amp;gt;= relative_time(now(),"-24h")&lt;BR /&gt;
does this work?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:53:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461329#M191378</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T01:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461330#M191379</link>
      <description>&lt;P&gt;Doesn't work either.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 09:19:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461330#M191379</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-08-25T09:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461331#M191380</link>
      <description>&lt;P&gt;hmm could we see a bit more &lt;BR /&gt;
if you do | datamodel &lt;BR /&gt;
what is the output (can you paste a screengrab?) can you see time in the output?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 09:23:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461331#M191380</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-25T09:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461332#M191381</link>
      <description>&lt;P&gt;see the json output carefully, i suspect any reference to 'time' is missing&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 09:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461332#M191381</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-25T09:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461333#M191382</link>
      <description>&lt;P&gt;I added two pics.&lt;BR /&gt;
You can see there that the data model has a _time field.&lt;BR /&gt;
Also when i table the results by _time i have results.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 10:42:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461333#M191382</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-08-25T10:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461334#M191383</link>
      <description>&lt;P&gt;| tstats values FROM datamodel=internal_server where nodename=server.scheduler.alerts earliest_time=-24h latest_time=now()&lt;/P&gt;

&lt;P&gt;this works on the internal_server and should work for you as it runs on the default internal index.&lt;BR /&gt;
if this runs all you need to do is replace the datamodel name with yours&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:53:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461334#M191383</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T01:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461335#M191384</link>
      <description>&lt;P&gt;I ran your query and it also doesn't refer to the time inside the query, but to the time in the time picker.&lt;BR /&gt;
time picker set to 15 minutes. &lt;/P&gt;

&lt;P&gt;"| tstats values FROM datamodel=internal_server where nodename=server.scheduler.alerts earliest_time=-24h latest_time=now()"&lt;/P&gt;

&lt;P&gt;Complete  7,966 events (8/25/19 2:01:19.000 PM to 8/25/19 2:16:19.000 PM)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:53:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461335#M191384</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2020-09-30T01:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461336#M191385</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158897"&gt;@astatrial&lt;/a&gt; &lt;BR /&gt;
I am not very clear on this - ' and it also doesn't refer to the time inside the query, but to the time in the time picker.time picker set to 15 minutes.'&lt;BR /&gt;
it will calculate the time from now() till 15 mins. ago . when you run index=xyz earliest_time=-15min latest_time=now()&lt;BR /&gt;
This also will run from 15 mins ago to now(), now() being the splunk system time.&lt;BR /&gt;
so if i run this | tstats values FROM datamodel=internal_server where nodename=server.scheduler.alerts earliest_time=-15min latest_time=now()&lt;BR /&gt;
i ran this for -24 h with 15 mins in the timepicker, ad you can see - values(date_mday) has 24 and 25, that is yesterday and today and values(date_hour) of course, has hours0-23. Does not look like this for you?&lt;BR /&gt;
 &lt;IMG src="https://community.splunk.com/storage/temp/274486-tst.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461336#M191385</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T01:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461337#M191386</link>
      <description>&lt;P&gt;Yes this is exactly what i say. &lt;BR /&gt;
I have to use from datamodel and not tstats any way. &lt;BR /&gt;
The most weird thing is that the original query does work on other system. &lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 12:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461337#M191386</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-08-25T12:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461338#M191387</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158897"&gt;@astatrial&lt;/a&gt; &lt;BR /&gt;
tstats is a good and recommended way to search accelarated datamodels, you can rename values(fields) as your chosen field names. tstats values returns the values associated with the datamodel.&lt;BR /&gt;
Coming to the timepicker issue, it does not matter what value you choose from the timepicker WHERE you have defined time modifiers in the query, this is a default functionality. time modifier will always over ride the time picker, that is true in general for any splunk query. why would you assign time modifiers if you want a selection based on the time picker?&lt;/P&gt;

&lt;P&gt;'The most weird thing is that the original query does work on other system. ' are you saying this in reference to your datamodel query , that is this one - | from datamodel:"Authentication"."Failed_Authentication" &lt;BR /&gt;
 | search src="ABC" app="win:unknown" earliest_time=-24h latest_time=now()&lt;/P&gt;

&lt;P&gt;If yes, it could be a permission issue. can you check permissions under this - Settings-&amp;gt;Data models?&lt;BR /&gt;
if the users who are able to use the above query exist, they are perhaps in the admin role.&lt;BR /&gt;
Alternatively, you can also assign the accelerate_search capability to the users who are not able to run this datamodel search. All this however is assuming that the above datamodel query works for some users.&lt;BR /&gt;
Can you check it out?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461338#M191387</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T01:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest_time and Latest_time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461339#M191388</link>
      <description>&lt;P&gt;I don't want the selection to be base on the time picker, but it does it any way (i get "7,966 events (8/25/19 2:01:19.000 PM to 8/25/19 2:16:19.000 PM") instead of a time window of 24 hours).&lt;/P&gt;

&lt;P&gt;I am familiar with this command, but i still have to use "from datamodel". &lt;/P&gt;

&lt;P&gt;I already checked the permissions, i have all necessary ones. &lt;/P&gt;

&lt;P&gt;The two systems a a bit different. Both in aspect of cloud vs enterprise and versions 7.0.9.1 vs  7.3 &lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 12:43:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Earliest-time-and-Latest-time/m-p/461339#M191388</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-08-25T12:43:51Z</dc:date>
    </item>
  </channel>
</rss>

