<?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 Timechart using an epoch timestamp in the row instead of _time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386438#M112773</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm using JSON extract on my rows.  I want to use the value that is contained in "message.time" instead of _time to timechart against.&lt;/P&gt;

&lt;P&gt;This field is a UNIX epoch timestamp, for example &lt;CODE&gt;1525847317&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am trying this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type" 
| eval _time=message.time
| dedup message.userId
| timechart span=1month count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Somebody else has said elsewhere on the forums that internally _time is an epoch value and it's just converted in the display to a string like &lt;CODE&gt;2018-05-09T13:33:57.000+03:00&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I have also tried &lt;CODE&gt;| eval _time=strftime(message.time, '%Ez')&lt;/CODE&gt; and also the &lt;CODE&gt;strptime&lt;/CODE&gt; function, just in case.&lt;/P&gt;

&lt;P&gt;Whatever I try the &lt;CODE&gt;_time&lt;/CODE&gt; variable is cut out of the event (when I expand the event row) and my statistics table never contains any data.&lt;/P&gt;

&lt;P&gt;How can I use the epoch timestamp value to timechart against?&lt;/P&gt;

&lt;P&gt;EDIT:&lt;/P&gt;

&lt;P&gt;This query shows three rows, &lt;CODE&gt;_time&lt;/CODE&gt; formatted like &lt;CODE&gt;2018-05-09 14:06:56&lt;/CODE&gt; and &lt;CODE&gt;timetest&lt;/CODE&gt;/&lt;CODE&gt;message_time&lt;/CODE&gt; both formatted as Unix epoch timestamps.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type"  
| eval timetest=_time
| dedup message.userId
| table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query has blank (empty) columns for &lt;CODE&gt;_time&lt;/CODE&gt; and &lt;CODE&gt;timetest&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type"  
| eval _time=message.time
| eval timetest=_time
| dedup message.userId
| table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query has a blank column for &lt;CODE&gt;timetest&lt;/CODE&gt;, but &lt;CODE&gt;_time&lt;/CODE&gt; is  populated.... maybe there is a problem with field extraction?  The documentation &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/Knowledge/Addanevalexpressionattribute"&gt;http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/Knowledge/Addanevalexpressionattribute&lt;/A&gt; says that you can use an auto-extracted field to eval with.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type"  
| eval timetest=message.time
| dedup message.userId
| table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 May 2018 11:26:48 GMT</pubDate>
    <dc:creator>andrewbeak</dc:creator>
    <dc:date>2018-05-09T11:26:48Z</dc:date>
    <item>
      <title>Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386438#M112773</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm using JSON extract on my rows.  I want to use the value that is contained in "message.time" instead of _time to timechart against.&lt;/P&gt;

&lt;P&gt;This field is a UNIX epoch timestamp, for example &lt;CODE&gt;1525847317&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am trying this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type" 
| eval _time=message.time
| dedup message.userId
| timechart span=1month count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Somebody else has said elsewhere on the forums that internally _time is an epoch value and it's just converted in the display to a string like &lt;CODE&gt;2018-05-09T13:33:57.000+03:00&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I have also tried &lt;CODE&gt;| eval _time=strftime(message.time, '%Ez')&lt;/CODE&gt; and also the &lt;CODE&gt;strptime&lt;/CODE&gt; function, just in case.&lt;/P&gt;

&lt;P&gt;Whatever I try the &lt;CODE&gt;_time&lt;/CODE&gt; variable is cut out of the event (when I expand the event row) and my statistics table never contains any data.&lt;/P&gt;

&lt;P&gt;How can I use the epoch timestamp value to timechart against?&lt;/P&gt;

&lt;P&gt;EDIT:&lt;/P&gt;

&lt;P&gt;This query shows three rows, &lt;CODE&gt;_time&lt;/CODE&gt; formatted like &lt;CODE&gt;2018-05-09 14:06:56&lt;/CODE&gt; and &lt;CODE&gt;timetest&lt;/CODE&gt;/&lt;CODE&gt;message_time&lt;/CODE&gt; both formatted as Unix epoch timestamps.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type"  
| eval timetest=_time
| dedup message.userId
| table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query has blank (empty) columns for &lt;CODE&gt;_time&lt;/CODE&gt; and &lt;CODE&gt;timetest&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type"  
| eval _time=message.time
| eval timetest=_time
| dedup message.userId
| table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query has a blank column for &lt;CODE&gt;timetest&lt;/CODE&gt;, but &lt;CODE&gt;_time&lt;/CODE&gt; is  populated.... maybe there is a problem with field extraction?  The documentation &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/Knowledge/Addanevalexpressionattribute"&gt;http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/Knowledge/Addanevalexpressionattribute&lt;/A&gt; says that you can use an auto-extracted field to eval with.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="my_source_type"  
| eval timetest=message.time
| dedup message.userId
| table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 May 2018 11:26:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386438#M112773</guid>
      <dc:creator>andrewbeak</dc:creator>
      <dc:date>2018-05-09T11:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386439#M112774</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;You should be able to use the timestamp as it is, because it has to be an epoch timestamp. Did you check if there is maybe any excess data in that field, like spaces, &lt;CODE&gt;"&lt;/CODE&gt; or &lt;CODE&gt;'&lt;/CODE&gt; or something like this?&lt;BR /&gt;
Don't be confused about being unable to see &lt;CODE&gt;_time&lt;/CODE&gt; - fields starting with &lt;CODE&gt;_&lt;/CODE&gt; are invisible by default, you could do a second eval like &lt;CODE&gt;| eval timetest=_time&lt;/CODE&gt; to see if it actually worked, just in case.&lt;BR /&gt;
However, that should work fine, because timechart operates on &lt;CODE&gt;_time&lt;/CODE&gt; by default...&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 11:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386439#M112774</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-09T11:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386440#M112775</link>
      <description>&lt;P&gt;Thanks for the reply, I thought from reading other answers that it should work like that, but it definitely doesn't.  I've updated the question with more details.  Could it be something to do with field extraction maybe?  &lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386440#M112775</guid>
      <dc:creator>andrewbeak</dc:creator>
      <dc:date>2018-05-09T12:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386441#M112776</link>
      <description>&lt;P&gt;Try making this an explicetely extracted field - at the moment you're using KV_MODE to do this, right?&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386441#M112776</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-09T12:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386442#M112777</link>
      <description>&lt;P&gt;Yes, I'm using KV_MODE.  Piping the search through &lt;CODE&gt;extract&lt;/CODE&gt; just duplicates the &lt;CODE&gt;message.time&lt;/CODE&gt; field (two values appear for every row when I output the table as above) and the timetest is still empty.  The documentation claims that auto-extracted fields should work.  Should I raise this as a bug to Splunk?&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386442#M112777</guid>
      <dc:creator>andrewbeak</dc:creator>
      <dc:date>2018-05-09T12:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386443#M112778</link>
      <description>&lt;P&gt;Yeah, it should work, &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Searchtimeoperationssequence"&gt;this document&lt;/A&gt; says the same.&lt;BR /&gt;
Just thought to make it explicit (as in, create as an extracted field with regex, just to make sure).&lt;/P&gt;

&lt;P&gt;Also, you said you tried this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype="my_source_type"  
 | eval _time=message.time
 | eval timetest=_time
 | dedup message.userId
 | table _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype="my_source_type"  
 | eval oldtime=_time
 | eval _time=message.time
 | eval timetest=_time
 | dedup message.userId
 | table oldtime, _time, timetest, message.time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is _time showing the same timestamp as oldtime? If yes, it somehow didn't get overwritten by message.time...&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386443#M112778</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-09T12:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386444#M112779</link>
      <description>&lt;P&gt;Hi, thanks for all the help.&lt;/P&gt;

&lt;P&gt;With that query:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;oldtime is populated with a timestamp, &lt;/LI&gt;
&lt;LI&gt;_time is blank, &lt;/LI&gt;
&lt;LI&gt;timetest is blank, and &lt;/LI&gt;
&lt;LI&gt;message.time is the timestamp&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Setting _time to a literal (1525869721, for example) works.... it gets overwritten.&lt;/P&gt;

&lt;P&gt;This looks like a bug with Splunk cloud to me, because the results I'm seeing definitely don't match what I expect from the documentation.  &lt;/P&gt;

&lt;P&gt;Thanks again, I'm going to raise a bug against this behaviour.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386444#M112779</guid>
      <dc:creator>andrewbeak</dc:creator>
      <dc:date>2018-05-09T13:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386445#M112780</link>
      <description>&lt;P&gt;The only thing that comes to my mind, that would be easy to test, to try to copy the _indextime field to the _time field. _indextime always exists, is extracted at index time, and I've done this often, if that also doesn't work it would be a good indicator.&lt;/P&gt;

&lt;P&gt;So, give it a try, replace message.time with _indextime.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:18:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386445#M112780</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-09T13:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386446#M112781</link>
      <description>&lt;P&gt;If I just replace _time with _indextime, like this: &lt;CODE&gt;eval _time=_indextime&lt;/CODE&gt; then I have values in _time.&lt;/P&gt;

&lt;P&gt;I cannot seem to overwrite message.time because _time is blank in this query:&lt;/P&gt;

&lt;P&gt;sourcetype="amino:analyticsevent"  index="dna_prod_analytic_event"&lt;BR /&gt;
  | eval message.time=_indextime&lt;BR /&gt;
  | eval _time=message.time&lt;BR /&gt;
  | table _time, message.time&lt;/P&gt;

&lt;P&gt;Making an entirely new variable (not trying to overwrite the extracted variable) results in _time having values:&lt;/P&gt;

&lt;P&gt;sourcetype="amino:analyticsevent"  index="dna_prod_analytic_event"&lt;BR /&gt;
  | eval foo=_indextime&lt;BR /&gt;
  | eval _time=foo&lt;BR /&gt;
  | table  _time, message.time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386446#M112781</guid>
      <dc:creator>andrewbeak</dc:creator>
      <dc:date>2020-09-29T19:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386447#M112782</link>
      <description>&lt;P&gt;Ah, doom. Some commands fail when you have fields with dots, or other stuff inside, so you might want to try to put that message.time in &lt;CODE&gt;"&lt;/CODE&gt; or &lt;CODE&gt;'&lt;/CODE&gt; - maybe that helps.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386447#M112782</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-09T13:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386448#M112783</link>
      <description>&lt;P&gt;Nope, that just treats it like a string literal and my column values are now all the string "message.time" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  I've raised the issue with Splunk.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 14:06:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386448#M112783</guid>
      <dc:creator>andrewbeak</dc:creator>
      <dc:date>2018-05-09T14:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart using an epoch timestamp in the row instead of _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386449#M112784</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="YouShouldAlwaysSpecifyIndex" AND sourcetype="my_source_type"
| dedup message.userId
| rex field=message.time "(?&amp;lt;_time&amp;gt;\d+)"
| timechart span=1month count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 05:35:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-using-an-epoch-timestamp-in-the-row-instead-of-time/m-p/386449#M112784</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-10T05:35:23Z</dc:date>
    </item>
  </channel>
</rss>

