<?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 Write a Search query for the Timestamp field which is different from _time value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671857#M230209</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You must remember that as splunk is using a timeseries "database" those values are stored into buckets based on _time. Splunk always use that _time value when you are searching events from buckets!&lt;/P&gt;&lt;P&gt;This means that if you are using earliest + latest to get events from buckets and then make final selection based on that separate Timestamp field, Splunk do that only from events which _time is between earliest and latest. If your Timestamp fields has your needed values outside of earliest - latest then you didn't get those!&lt;/P&gt;&lt;P&gt;For that reason you should think (based on your data and use case), should you fix the ingestion to put that Timestamp field into _time? Or is your current way that _time have something else than Timestamp better way. IMHO is that you should fix your _time value on ingestion phase instead of trying to guess where those event could be (usually this leads quite open time spans).&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 08:37:24 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2023-12-14T08:37:24Z</dc:date>
    <item>
      <title>How To Write a Search query for the Timestamp field which is different from _time value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671843#M230202</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Need a help to write a query based on the field "Timestamp" which is different from "_time" value.&lt;/P&gt;&lt;P&gt;Sample Event in XML Format:&lt;/P&gt;&lt;P&gt;Email: xyz@gmail.com&lt;BR /&gt;RoleName: User&lt;BR /&gt;RowKey: 123456&lt;BR /&gt;Timestamp: 2023-12-13T23:56:18.200016+00:00&lt;BR /&gt;UserId: mno&lt;BR /&gt;UserName: acho&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is one of the sample event in xml format and there is a specific field as "Timestamp" in the event and this "Timestamp" field is completely different from _time value. Hence I want to pull only the "Timestamp" value for a particular day might be yesterday 2023-12-13 i.e. from 2023-12-13 00:00:00 to 2023-12-13 23:59:59&lt;/P&gt;&lt;P&gt;So how can I write the query for the same.&lt;/P&gt;&lt;P&gt;index=abc host=xyz sourcetype=xxx&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 07:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671843#M230202</guid>
      <dc:creator>anandhalagaras1</dc:creator>
      <dc:date>2023-12-14T07:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: How To Write a Search query for the Timestamp field which is different from _time value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671851#M230205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207926"&gt;@anandhalagaras1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to compare dates you have to convert them in epochtime and compare using the eval command and strptime function:&lt;/P&gt;&lt;P&gt;e.g. to take only events with Timestamp in the period&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;from 2023-12-13 00:00:00 to 2023-12-13 23:59:59, yu could run:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; 
| eval 
   Timestamp=strptime(Timestamp,"%Y-%m-%d %H:%M:%S"),
   from=strptime("2023-12-13 00:00:00","%Y-%m-%d %H:%M:%S"),
   to=strptime("2023-12-13 23:59:59"","%Y-%m-%d %H:%M:%S")
| where Timestamp&amp;gt;=from AND Timestamp&amp;lt;=to&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 07:51:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671851#M230205</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-12-14T07:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: How To Write a Search query for the Timestamp field which is different from _time value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671856#M230208</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=xyz host=abc sourcetype=mkb&lt;BR /&gt;| eval&lt;BR /&gt;Timestamp=strptime(Timestamp,"%Y-%m-%d %H:%M:%S"),&lt;BR /&gt;from=strptime("2023-12-13 00:00:00","%Y-%m-%d %H:%M:%S"),&lt;BR /&gt;to=strptime("2023-12-13 23:59:59","%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| where Timestamp&amp;gt;=from AND Timestamp&amp;lt;=to&lt;/P&gt;&lt;P&gt;When i used this search query I am not getting any events at all. I ran the query for last 30 days as well but there is no events getting displayed but actually there are events for the same. So is there any modification needs to be done in the query kindly let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 08:22:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671856#M230208</guid>
      <dc:creator>anandhalagaras1</dc:creator>
      <dc:date>2023-12-14T08:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: How To Write a Search query for the Timestamp field which is different from _time value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671857#M230209</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You must remember that as splunk is using a timeseries "database" those values are stored into buckets based on _time. Splunk always use that _time value when you are searching events from buckets!&lt;/P&gt;&lt;P&gt;This means that if you are using earliest + latest to get events from buckets and then make final selection based on that separate Timestamp field, Splunk do that only from events which _time is between earliest and latest. If your Timestamp fields has your needed values outside of earliest - latest then you didn't get those!&lt;/P&gt;&lt;P&gt;For that reason you should think (based on your data and use case), should you fix the ingestion to put that Timestamp field into _time? Or is your current way that _time have something else than Timestamp better way. IMHO is that you should fix your _time value on ingestion phase instead of trying to guess where those event could be (usually this leads quite open time spans).&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 08:37:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671857#M230209</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-12-14T08:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: How To Write a Search query for the Timestamp field which is different from _time value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671864#M230215</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207926"&gt;@anandhalagaras1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;sorry, I didn't notice that the format of Timestamp was different than the other two, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; 
| eval 
   Timestamp=strptime(Timestamp,"%Y-%m-%dT%H:%M:%S.%6N%:z"),
   from=strptime("2023-12-13 00:00:00","%Y-%m-%d %H:%M:%S"),
   to=strptime("2023-12-13 23:59:59"","%Y-%m-%d %H:%M:%S")
| where Timestamp&amp;gt;=from AND Timestamp&amp;lt;=to&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 08:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671864#M230215</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-12-14T08:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How To Write a Search query for the Timestamp field which is different from _time value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671891#M230221</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207926"&gt;@anandhalagaras1&lt;/a&gt;&amp;nbsp;- Run the query like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your index, sourcetype search&amp;gt; earliest=0 latest=now
&amp;lt;your_search&amp;gt;
| eval Timestamp=strptime(Timestamp,"%Y-%m-%dT%H:%M:%S.%6N%:z")
| addinfo
| where Timestamp&amp;gt;=info_min_time AND Timestamp&amp;lt;=info_max_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this query, you can change the timerange from UI to apply on search directly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Performance Hint: This query will be run on "All Time" as the earliest and latest suggest in the first line of the query, you can twick it for dashboard to improve performance of the query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!!!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 12:45:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Write-a-Search-query-for-the-Timestamp-field-which-is/m-p/671891#M230221</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2023-12-14T12:45:26Z</dc:date>
    </item>
  </channel>
</rss>

