<?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: Using a different value for _time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457659#M129247</link>
    <description>&lt;P&gt;And yes this is for a search being piped into a dashboard&lt;/P&gt;</description>
    <pubDate>Sat, 11 May 2019 22:48:06 GMT</pubDate>
    <dc:creator>williamsmew</dc:creator>
    <dc:date>2019-05-11T22:48:06Z</dc:date>
    <item>
      <title>Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457656#M129244</link>
      <description>&lt;P&gt;index=av sourcetype=BobsCutRateAV category="BadStuffHappening" &lt;BR /&gt;
| eval date_hour=strftime(_time, "%H") &lt;BR /&gt;
| eval date_wday = strftime(_time, "%w") &lt;BR /&gt;
| search (date_hour&amp;gt;18 OR date_hour&amp;lt;6) OR (date_wday=0 OR date_wday=6) &lt;BR /&gt;
| timechart count&lt;/P&gt;

&lt;P&gt;This works. The problem is that _time reflects when the event is reported not when it was detected. The field I need is &lt;STRONG&gt;detected_timestamp&lt;/STRONG&gt; which is formatted as detected_timestamp="2019-04-11 02:31:52.0"&lt;/P&gt;

&lt;P&gt;I did not create this but have been tasked with modifying it. I have looked at documentation and the many things I have tried do not work. Your help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:32:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457656#M129244</guid>
      <dc:creator>williamsmew</dc:creator>
      <dc:date>2020-09-30T00:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457657#M129245</link>
      <description>&lt;P&gt;Assuming you always want to use detected_timetamp and never what is now _time, I'd recommend changing the timestamp extraction for that sourcetype. See &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/Data/Configuretimestamprecognition" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/Data/Configuretimestamprecognition&lt;/A&gt; for how, and open new questions with any issues you might have.&lt;/P&gt;

&lt;P&gt;If you want to do this in some search without changing the data getting indexed because most of the time what is now _time is the right time and only this time you want detected_timestamp, you can do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval _time = strptime(detected_timestamp, "%F %T.%N") | eval date_hour = ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;XOR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval date_hour ... | eval date_wday = ... | search ... | eval _time = strptime(detected_timestamp, "%F %T.%N") | timechart count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;depending on whether the date_hour/date_wday filters you have right now should be applied to _time or detected_timestamp.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457657#M129245</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2020-09-30T00:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457658#M129246</link>
      <description>&lt;P&gt;Thanks for the response&lt;/P&gt;

&lt;P&gt;Im confused where the "%F %T.%N" is from and how %H and %w is extracted, from what I can find I was using "%Y-%m-%d %H:%M:%S.%1n"&lt;/P&gt;

&lt;P&gt;I dont have much in the way of resources to pull from here, these forums will be about it, so thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 22:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457658#M129246</guid>
      <dc:creator>williamsmew</dc:creator>
      <dc:date>2019-05-11T22:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457659#M129247</link>
      <description>&lt;P&gt;And yes this is for a search being piped into a dashboard&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 22:48:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457659#M129247</guid>
      <dc:creator>williamsmew</dc:creator>
      <dc:date>2019-05-11T22:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457660#M129248</link>
      <description>&lt;P&gt;&lt;CODE&gt;%F&lt;/CODE&gt; is short for &lt;CODE&gt;%Y-%m-%d&lt;/CODE&gt;, &lt;CODE&gt;%T&lt;/CODE&gt; is short for &lt;CODE&gt;%H:%M:%S&lt;/CODE&gt; - see &lt;A href="http://www.strftime.net/"&gt;http://www.strftime.net/&lt;/A&gt; for an easy to use reference.&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 23:35:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457660#M129248</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2019-05-11T23:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457661#M129249</link>
      <description>&lt;P&gt;Yup, finally found that under Date and time variables. What perplexes me is why &lt;EM&gt;eval _time = strptime(detected_timestamp, "%Y-%m-%d %H:%M:%S.%N")&lt;/EM&gt; does not work since it seems to be the the same as the F T N &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:32:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457661#M129249</guid>
      <dc:creator>williamsmew</dc:creator>
      <dc:date>2020-09-30T00:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457662#M129250</link>
      <description>&lt;P&gt;Does this work in an empty search bar?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval detected_timestamp="2019-04-11 02:31:52.5" | eval _time = strptime(detected_timestamp, "%Y-%m-%d %H:%M:%S.%N")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 May 2019 00:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457662#M129250</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2019-05-12T00:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using a different value for _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457663#M129251</link>
      <description>&lt;P&gt;Yes it does&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 00:15:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-a-different-value-for-time/m-p/457663#M129251</guid>
      <dc:creator>williamsmew</dc:creator>
      <dc:date>2019-05-12T00:15:51Z</dc:date>
    </item>
  </channel>
</rss>

