<?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: Epoch Time to Conventional Time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28775#M5733</link>
    <description>&lt;P&gt;Hi linu1988,&lt;/P&gt;

&lt;P&gt;once did some epoch to human readable converting using this commands:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  convert timeformat="%Y-%m-%d %T" mktime(Message_time) | fieldformat Message_time=strftime(Message_time,"%Y-%m-%d %T")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;adapted to your search it should be something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats max(_time) as LastBackup,min(_time) as StartBackup,sum(FileSize) as TotalBackupSize | eval TimeDiff=LastBackup-StartBackup | fieldformat TimeDiff=strftime(TimeDiff,"%T") | table StartBackup LastBackup TimeDiff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does that make sense?&lt;/P&gt;

&lt;P&gt;Cheers, MuS&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2013 12:03:24 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2013-08-08T12:03:24Z</dc:date>
    <item>
      <title>Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28774#M5732</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I am having trouble converting to Hour:Minute:Second format from epoch time&lt;/P&gt;

&lt;P&gt;First i have made a subtraction which i want it to be in human readable format. But it's giving me wrong result. Below is my query.&lt;/P&gt;

&lt;P&gt;|Stats max(_time) as LastBackup,min(_time) as StartBackup,sum(FileSize) as TotalBackupSize | eval TimeDiff=LastBackup-StartBackup| table StartBackup LastBackup TimeDiff|eval Total=strftime(TimeDiff,"%H:%M:%S")&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;StartBackup LastBackup  TimeDiff    Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1   1375920004  1375929896  9892           04:44:5&lt;/P&gt;

&lt;P&gt;But the value should be 2:44:5, Why am i getting such wrong result?&lt;/P&gt;

&lt;P&gt;Any insight will be much appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:31:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28774#M5732</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2020-09-28T14:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28775#M5733</link>
      <description>&lt;P&gt;Hi linu1988,&lt;/P&gt;

&lt;P&gt;once did some epoch to human readable converting using this commands:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  convert timeformat="%Y-%m-%d %T" mktime(Message_time) | fieldformat Message_time=strftime(Message_time,"%Y-%m-%d %T")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;adapted to your search it should be something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats max(_time) as LastBackup,min(_time) as StartBackup,sum(FileSize) as TotalBackupSize | eval TimeDiff=LastBackup-StartBackup | fieldformat TimeDiff=strftime(TimeDiff,"%T") | table StartBackup LastBackup TimeDiff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does that make sense?&lt;/P&gt;

&lt;P&gt;Cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 12:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28775#M5733</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2013-08-08T12:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28776#M5734</link>
      <description>&lt;P&gt;The reason for the 'wrong' result is that you asked for a conversion of the &lt;CODE&gt;epoch&lt;/CODE&gt; 9892, which occurred on January 1st, 1970, at 02:44:52. That is quite different from a generic duration in seconds. However, since you only present the H:M:S part of the result, that may not be obvious at first glance. Could it be that you are two timezones east of London? That could explain the two extra hours.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 12:34:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28776#M5734</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-08T12:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28777#M5735</link>
      <description>&lt;P&gt;That correct? From the docs on &lt;CODE&gt;convert&lt;/CODE&gt;:&lt;/P&gt;

&lt;P&gt;mktime()&lt;BR /&gt;
    Syntax: mktime(&lt;WC-FIELD&gt;) &lt;BR /&gt;
    Description: Convert an human readable time string to an epoch time. Use timeformat option to specify exact format to convert from. &lt;/WC-FIELD&gt;&lt;/P&gt;

&lt;P&gt;If the docs are right, you'd be trying to convert epoch (treated as %T) into epoch.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 12:40:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28777#M5735</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-08T12:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28778#M5736</link>
      <description>&lt;P&gt;hehe, copy paste error - updated the answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 12:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28778#M5736</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2013-08-08T12:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28779#M5737</link>
      <description>&lt;P&gt;Now this comment make some sense, I got the point. On the timezone we have splunk server and The actual servers on the same timezone. How do i get the actual difference of the time on the event's the question as it's 2:44 not 4:44 minutes&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 12:54:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28779#M5737</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-08-08T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28780#M5738</link>
      <description>&lt;P&gt;Hey MuS,&lt;BR /&gt;
My query wasn't that different from yours. It gave me the same answer i was getting. I am not confident why the time difference is coming like this, but having so many great functionality in Splunk this small things should be coming automatically rather this much thinking. At last i ended up with below:&lt;/P&gt;

&lt;P&gt;| eval TimeDiff=LastBackup-StartBackup | eval hour=floor(TimeDiff / 3600)|eval min=floor((TimeDiff / 60) % 60)|eval sec=TimeDiff % 60|eval TimeDiff=hour.":".min.":".sec| table StartBackup LastBackup TimeDiff&lt;/P&gt;

&lt;P&gt;May look dirty but i am at least getting the result&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 13:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28780#M5738</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-08-08T13:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28781#M5739</link>
      <description>&lt;P&gt;Yes, Splunk and the source server may be in the same TZ, but &lt;CODE&gt;epoch&lt;/CODE&gt; is always in UTC, which is why I figured that you may be in central Europe. With daylight saving, CET is two hours ahead of UTC. &lt;/P&gt;

&lt;P&gt;So the 2:44 (or 4:44) is not duration expressed as H:M or M:S, but rather the actual time.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 20:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28781#M5739</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-08T20:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Epoch Time to Conventional Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28782#M5740</link>
      <description>&lt;P&gt;source="dbmon-tail://idwarehouse/idw_account" application=TFAYD [|inputlookup execSSO.csv |rename sso as owner] |eval exp_date=strftime(relative_time(Lastpasswordchangedate, "+90d@d"), "%Y/%m/%d %H:%M") | eval exp_days=floor((exp_date-Lastpasswordchangedate)/86400)  |rename lastPasswordChange AS Lastpasswordchangedate  &lt;/P&gt;

&lt;P&gt;This is the query , &lt;/P&gt;

&lt;P&gt;Lastpasswordchangedate =2014-08-06 11:20:39&lt;BR /&gt;
application =TFAYD&lt;BR /&gt;
exp_date =2004/07/07 00:00&lt;BR /&gt;
owner =206404613&lt;BR /&gt;
refreshedDate =2014-09-26 09:15:25&lt;BR /&gt;
sourcetype =mysql &lt;/P&gt;

&lt;P&gt;i need exp_date output 90 days from Lastpasswordchangedate ,  but iam getting wrong output . any one can help me on this ... &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Epoch-Time-to-Conventional-Time/m-p/28782#M5740</guid>
      <dc:creator>siraj198204</dc:creator>
      <dc:date>2020-09-28T17:43:04Z</dc:date>
    </item>
  </channel>
</rss>

