<?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 convert epoch time to human readable format issue in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478876#M82196</link>
    <description>&lt;P&gt;Hello Fellows,&lt;/P&gt;

&lt;P&gt;I am trying to convert epoch time to "%m/%d/%Y %H:%M:%S" format. The epoch time is reflecting in the events,I am extracting using regex in the search and after that trying to convert the epoch time and use it in the search. It is not showing any value in the human readable time column.Kindly help&lt;/P&gt;

&lt;P&gt;events: &lt;/P&gt;

&lt;P&gt;query I am using:&lt;BR /&gt;
index=abc sourcetype=xyz &lt;BR /&gt;
| rex field=_raw ^(?P\d+\s+)&lt;BR /&gt;
| eval timestamp=strftime(strptime(epoch_time,"%m/%d/%Y %H:%M:%S"),"%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
| table host epoch_time timestamp&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 02:09:32 GMT</pubDate>
    <dc:creator>Arpmjdr</dc:creator>
    <dc:date>2020-09-30T02:09:32Z</dc:date>
    <item>
      <title>convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478876#M82196</link>
      <description>&lt;P&gt;Hello Fellows,&lt;/P&gt;

&lt;P&gt;I am trying to convert epoch time to "%m/%d/%Y %H:%M:%S" format. The epoch time is reflecting in the events,I am extracting using regex in the search and after that trying to convert the epoch time and use it in the search. It is not showing any value in the human readable time column.Kindly help&lt;/P&gt;

&lt;P&gt;events: &lt;/P&gt;

&lt;P&gt;query I am using:&lt;BR /&gt;
index=abc sourcetype=xyz &lt;BR /&gt;
| rex field=_raw ^(?P\d+\s+)&lt;BR /&gt;
| eval timestamp=strftime(strptime(epoch_time,"%m/%d/%Y %H:%M:%S"),"%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
| table host epoch_time timestamp&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:09:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478876#M82196</guid>
      <dc:creator>Arpmjdr</dc:creator>
      <dc:date>2020-09-30T02:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478877#M82197</link>
      <description>&lt;P&gt;can you show how your extracted epoch time looks like?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 08:11:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478877#M82197</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-09-10T08:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478878#M82198</link>
      <description>&lt;P&gt;sure.it is reflecting as "1568095811"&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 08:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478878#M82198</guid>
      <dc:creator>Arpmjdr</dc:creator>
      <dc:date>2019-09-10T08:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478879#M82199</link>
      <description>&lt;P&gt;i have used this to extract "| rex field=_raw ^(?P(epoch_time)\d+\s+)" .. the line dint come properly while posting the question.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478879#M82199</guid>
      <dc:creator>Arpmjdr</dc:creator>
      <dc:date>2020-09-30T02:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478880#M82200</link>
      <description>&lt;P&gt;if your epoch_time is coming as a number, you probably need this &lt;CODE&gt;eval timestamp=strftime(epoch_time,"%m/%d/%Y %H:%M:%S")| table host epoch_time timestamp&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:09:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478880#M82200</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T02:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478881#M82201</link>
      <description>&lt;P&gt;I have tried this already.But no value is coming in the "timestamp" column in the table&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 09:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478881#M82201</guid>
      <dc:creator>Arpmjdr</dc:creator>
      <dc:date>2019-09-10T09:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478882#M82202</link>
      <description>&lt;P&gt;can you check if the epoch_time is coming as number or string when you extract it? it should come as # indicating number type, if it is coming as string use a tonumber() to convert the string to a number&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 09:35:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478882#M82202</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-09-10T09:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478883#M82203</link>
      <description>&lt;P&gt;Looks like your rex didn't copy correctly, so here is some speculation: your rex extracts the epoch time with a trailing space.&lt;/P&gt;

&lt;P&gt;This fails to return a timestamp field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="1568095811 and some text after"
| table _raw
| rex field=_raw "^(?P&amp;lt;epoch_time&amp;gt;\d+\s+)"
| eval timestamp=strftime(epoch_time,"%m/%d/%Y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this does return the field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="1568095811 and some text after"
| table _raw
| rex field=_raw "^(?P&amp;lt;epoch_time&amp;gt;\d+)\s+"
| eval timestamp=strftime(epoch_time,"%m/%d/%Y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the second one captures digits only, while the one above it allows for a trailing space which doesn't work with strftime.&lt;/P&gt;

&lt;P&gt;Again, this is speculation because you didn't provide the sample event and it looks like your rex paste got botched. Also, your rex mandates that the epoch time you are extracting is at the start of the line...make sure this is accurate. If you could post a sanitized event, that would help a lot. Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 19:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478883#M82203</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-09-10T19:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478884#M82204</link>
      <description>&lt;P&gt;you are 100% correct @jpolvino  my rex command was not proper.Now it is working perfect ..Thank u &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 11:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478884#M82204</guid>
      <dc:creator>Arpmjdr</dc:creator>
      <dc:date>2019-09-11T11:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: convert epoch time to human readable format issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478885#M82205</link>
      <description>&lt;P&gt;My rex command was not correct @Sukisen1981 . now it worked..Appreciate your inputs &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 11:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-epoch-time-to-human-readable-format-issue/m-p/478885#M82205</guid>
      <dc:creator>Arpmjdr</dc:creator>
      <dc:date>2019-09-11T11:38:08Z</dc:date>
    </item>
  </channel>
</rss>

