<?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 How to change the _time to values inside the event data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292681#M88343</link>
    <description>&lt;P&gt;I want to make area graphs of data usage on individual servers based on the timestamp given in the event data and not the default _time values. &lt;/P&gt;

&lt;P&gt;This is an example of an event:&lt;/P&gt;

&lt;P&gt;2017-06-29 19:32:57.254, DBNAME="BRMTPRD", SNAP_DATE="2017-06-18 03:00:32.0", TS_TYPE="REDO", TS_NAME="ONLINE_REDO_STBY", ALLOCATED_KB="3686400", USED_KB="3686400", FREE_KB="0", PCT_USED="100", LARGEST="0"&lt;/P&gt;

&lt;P&gt;I want to use the "SNAP_DATE" field as my "_time" values and then measure the "USED_KB" per day of "SNAP_DATE."&lt;/P&gt;

&lt;P&gt;Anything helps, thanks. &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:43:58 GMT</pubDate>
    <dc:creator>twmoffit</dc:creator>
    <dc:date>2020-09-29T14:43:58Z</dc:date>
    <item>
      <title>How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292681#M88343</link>
      <description>&lt;P&gt;I want to make area graphs of data usage on individual servers based on the timestamp given in the event data and not the default _time values. &lt;/P&gt;

&lt;P&gt;This is an example of an event:&lt;/P&gt;

&lt;P&gt;2017-06-29 19:32:57.254, DBNAME="BRMTPRD", SNAP_DATE="2017-06-18 03:00:32.0", TS_TYPE="REDO", TS_NAME="ONLINE_REDO_STBY", ALLOCATED_KB="3686400", USED_KB="3686400", FREE_KB="0", PCT_USED="100", LARGEST="0"&lt;/P&gt;

&lt;P&gt;I want to use the "SNAP_DATE" field as my "_time" values and then measure the "USED_KB" per day of "SNAP_DATE."&lt;/P&gt;

&lt;P&gt;Anything helps, thanks. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:43:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292681#M88343</guid>
      <dc:creator>twmoffit</dc:creator>
      <dc:date>2020-09-29T14:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292682#M88344</link>
      <description>&lt;P&gt;[]&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
TIME_FORMAT=%Y-%m-%d %H:%M:%S.%3N&lt;BR /&gt;
TIME_PREFIX=\d+-\d+-\d+\s\d+:\d+:\d+.\d+\,\sDBNAME=\"\S+\",\sSNAP_DATE=\"&lt;BR /&gt;
MAX_TIMESTAMP_LOOKAHEAD=21&lt;BR /&gt;
CHARSET=UTF-8&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292682#M88344</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T14:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292683#M88345</link>
      <description>&lt;P&gt;Hi  twmoffit,&lt;BR /&gt;
try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| eval SNAP_DATE=strptime(SNAP_DATE,"%Y-%m-%d %H:%M:%S.%N")
| bin span=1d SNAP_DATE
| eval SNAP_DATE=strftime(SNAP_DATE,"%Y-%m-%d")
| chart sum(USED_KB) by SNAP_DATE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:51:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292683#M88345</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-06-30T13:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292684#M88346</link>
      <description>&lt;P&gt;Similar to what @sbbadri proposed following should be added for your existing sourcetype definition (&lt;CODE&gt;TIME_PREFIX=SNAP_DATE="&lt;/CODE&gt; should be sufficient):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Your_Source_Type]
TIME_FORMAT=%Y-%m-%d %H:%M:%S.%N
TIME_PREFIX=SNAP_DATE="
MAX_TIMESTAMP_LOOKAHEAD=21
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You would need to re-index existing data.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:53:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292684#M88346</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-30T13:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292685#M88347</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Base Search ... | eval _time = strptime(SNAP_DATE, "%Y-%m-%d %H:%M:%S.%1Q") | timechart span=1d avg(USED_KB)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously, replace &lt;CODE&gt;avg(blah)&lt;/CODE&gt; with max or some other function as necessary.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292685#M88347</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-06-30T13:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292686#M88348</link>
      <description>&lt;P&gt;Great that works but now how do I make it so that the data is split up by the database name. I want to be able to compare the usages by each database in the index and create one graph showing the difference.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292686#M88348</guid>
      <dc:creator>twmoffit</dc:creator>
      <dc:date>2017-06-30T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292687#M88349</link>
      <description>&lt;P&gt;... | rex field=_raw "DBNAME=\"(?\S+)\" | chart sum(USED_KB) over SNAP_DATE by DBNAME&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:41:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292687#M88349</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T14:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292688#M88350</link>
      <description>&lt;P&gt;Check out this blog.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.splunk.com/blog/2016/09/16/i-cant-make-my-time-range-picker-pick.html"&gt;https://www.splunk.com/blog/2016/09/16/i-cant-make-my-time-range-picker-pick.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This will make the time range picker work and more.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 15:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292688#M88350</guid>
      <dc:creator>Claw</dc:creator>
      <dc:date>2018-05-18T15:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292689#M88351</link>
      <description>&lt;P&gt;I followed the instructions on the blog post and could not get it to work. I have a time field within my logs as &lt;BR /&gt;
&lt;CODE&gt;year=2018 month=04 day=05 hour=20 event_count=100&lt;/CODE&gt;. The event came in &lt;CODE&gt;2018-06-03 2000&lt;/CODE&gt;. I want to use the time picker to select events by their year, month, day, hour time fields. NOT when they came in. I overrode &lt;CODE&gt;_time&lt;/CODE&gt; as well. This is what I have in my source &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        index=index_1 OR index=index_2 category=mobile event_type=hive_events zone=aws
        | eval _time=strptime(time,"%Y-%m-%d-%H:%M:%S") 
        | sort - _time
        | addinfo
        | where _time &amp;amp;gt;= info_min_time AND (_time &amp;amp;lt;= info_max_time OR info_max_time = "+Infinity")
        | eval DateHour=year."-".month."-".day."-".hour
        | eval Start_Time=strftime(info_min_time, "%Y-%m-%d-%H:00")
        | eval End_Time=strftime(info_max_time, "%Y-%m-%d-%H:00")
        | table DateHour _time Start_time info_min_time End_time info_max_time zone event_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jun 2018 18:08:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292689#M88351</guid>
      <dc:creator>liondancer</dc:creator>
      <dc:date>2018-06-05T18:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the _time to values inside the event data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292690#M88352</link>
      <description>&lt;P&gt;If I understand your example and you have date and time in year=2018 month=04 day=05 hour=20 you will have to convert this to a single field for the strptime command to work.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eval my_time=year."-".month."-".day."-".hour."-0-0"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| eval _time=strptime(my_time,"%Y-%m-%d-%H:%M:%S")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-time-to-values-inside-the-event-data/m-p/292690#M88352</guid>
      <dc:creator>Claw</dc:creator>
      <dc:date>2018-06-05T20:55:59Z</dc:date>
    </item>
  </channel>
</rss>

