<?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: How do I convert epochtime = -1 to a human readable format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425661#M122023</link>
    <description>&lt;P&gt;It worked!. I did have to convert the date value in line 2 to epochtime to get the final result to figure in correctly, but it worked like a charm otherwise. Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 07 Dec 2018 15:09:10 GMT</pubDate>
    <dc:creator>lball</dc:creator>
    <dc:date>2018-12-07T15:09:10Z</dc:date>
    <item>
      <title>How do I convert epochtime = -1 to a human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425659#M122021</link>
      <description>&lt;P&gt;I am creating a dashboard for Tenable results and some entries have a Patch Publication Date value of -1. I'm having trouble getting the search to output results because I can't get the -1 value to resolve to a human readable date. Here is a copy of the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tenable | eval PatchPubDate=strftime(patchPubDate,"%Y-%m-%d") | stats by riskFactor,severity.id,pluginID,description,solution,pluginText,PatchPubDate,ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas of how to get the results to show when the date is -1? When I exclude the -1 values from the search all other epoch time values convert as desired.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 23:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425659#M122021</guid>
      <dc:creator>lball</dc:creator>
      <dc:date>2018-12-06T23:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert epochtime = -1 to a human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425660#M122022</link>
      <description>&lt;P&gt;You could modify the field &lt;CODE&gt;PatchPubDate&lt;/CODE&gt; before you get to there.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tenable 
| eval PatchPubDate=if(PatchPubDate==-1, "1970-07-17", PatchPubDate) 
| eval PatchPubDate=-strftime(patchPubDate,"%Y-%m-%d") 
| stats by riskFactor,severity.id,pluginID,description,solution,pluginText,PatchPubDate,ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See if that works.  It'll make it be my birthday.   You can't go much older, because the epoch isn't valid too much earlier than this.&lt;/P&gt;

&lt;P&gt;In your display code (e.g. that you don't have here - after all that you could do another eval and if it's 1970-07-17 you could change it to printing out a string like "invalid" if you wanted.)&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 04:05:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425660#M122022</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2018-12-07T04:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert epochtime = -1 to a human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425661#M122023</link>
      <description>&lt;P&gt;It worked!. I did have to convert the date value in line 2 to epochtime to get the final result to figure in correctly, but it worked like a charm otherwise. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 15:09:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425661#M122023</guid>
      <dc:creator>lball</dc:creator>
      <dc:date>2018-12-07T15:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert epochtime = -1 to a human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425662#M122024</link>
      <description>&lt;P&gt;Just replace the "invalid" timestamp value with something else. E.g.:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tenable 
| eval PatchPubDate=if(patchPubDate=-1, "unknown", strftime(patchPubDate,"%Y-%m-%d")) 
| stats by riskFactor,severity.id,pluginID,description,solution,pluginText,PatchPubDate,ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or if you still need it to be a timestamp, then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tenable 
| eval PatchPubDate=if(patchPubDate=-1, "1970-01-01", strftime(patchPubDate,"%Y-%m-%d")) 
| stats by riskFactor,severity.id,pluginID,description,solution,pluginText,PatchPubDate,ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Dec 2018 15:28:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-epochtime-1-to-a-human-readable-format/m-p/425662#M122024</guid>
      <dc:creator>petom</dc:creator>
      <dc:date>2018-12-07T15:28:38Z</dc:date>
    </item>
  </channel>
</rss>

