<?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 to convert epoch to human readable format at index time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463185#M130574</link>
    <description>&lt;P&gt;Hi @ricotries,&lt;BR /&gt;
when an event is indexed in Splunk a timestamp is assigned to it (at indextime) and stored in the _time field that's a field in epochtime but displayed in human readable format, so I don't understand your need, and it must be in epochtime to do all the calculations in events display.&lt;BR /&gt;
Anyway, if you want to have another field with the timestamp in human readable format, you could create a calculated field, starting from _time that displays timestamp in the format you want using the strftime function.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2020 14:36:20 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-02-06T14:36:20Z</dc:date>
    <item>
      <title>How to convert epoch to human readable format at index time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463184#M130573</link>
      <description>&lt;P&gt;I am currently monitoring a file that generates logs, but assigns the time in epoch format. Is there a way to transform/convert the epoch timestamp to a human readable format during index time?&lt;/P&gt;

&lt;P&gt;(I know there is a way to do this in a search query, but I would like to store the timestamp in a human readable format.)&lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
The file I am monitoring is /root/.bash_history (I made system configuration changes to make sure that every command execution is stored immediately) and most of the time Splunk does a very good job at assigning timestamps to each command execution, but sometimes it will create one event with multiple commands and assigns one timestamp to all of them. So I decided to generate a timestamp that is appended to every command. &lt;/P&gt;

&lt;P&gt;The way they are listed in the file is as such:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#1234567890
&amp;lt;command&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, I've set the correct configuration in props.conf to ensure that every two strings is one event, but now I'm trying to assign the "1234567890" as the timestamp of the event and make sure it shows in human readable format for search results.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463184#M130573</guid>
      <dc:creator>ricotries</dc:creator>
      <dc:date>2020-02-06T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to human readable format at index time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463185#M130574</link>
      <description>&lt;P&gt;Hi @ricotries,&lt;BR /&gt;
when an event is indexed in Splunk a timestamp is assigned to it (at indextime) and stored in the _time field that's a field in epochtime but displayed in human readable format, so I don't understand your need, and it must be in epochtime to do all the calculations in events display.&lt;BR /&gt;
Anyway, if you want to have another field with the timestamp in human readable format, you could create a calculated field, starting from _time that displays timestamp in the format you want using the strftime function.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:36:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463185#M130574</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-02-06T14:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to human readable format at index time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463186#M130575</link>
      <description>&lt;P&gt;Is it the actual timestamp from the event? If Splunk is not picking it up automatically you can use Timestamp format, Timestamp prefix, and lookahead to tell Splunk where the timestamp is and how to read it.&lt;BR /&gt;
Can you provide a few sample events?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463186#M130575</guid>
      <dc:creator>oscar84x</dc:creator>
      <dc:date>2020-02-06T14:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to human readable format at index time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463187#M130576</link>
      <description>&lt;P&gt;Let me see if I understood your answer correctly. _time already stores the timestamp of an event in epoch but during a search it is displayed in human readable format?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463187#M130576</guid>
      <dc:creator>ricotries</dc:creator>
      <dc:date>2020-02-06T14:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to human readable format at index time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463188#M130577</link>
      <description>&lt;P&gt;Hi @ricotries,&lt;BR /&gt;
yes, the displayed timestamp of your events isn't in human readable format?&lt;/P&gt;

&lt;P&gt;if you don't like the used format, you can change it using strftime function, but it's readable!&lt;/P&gt;

&lt;P&gt;Anyway, _time must be in epochtime otherwise you cannot do comparisons between dates: infact if you want to compare two dates in Human readable format, you have to convert in epochtime, compare them and eventually re convert in human.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:50:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463188#M130577</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-02-06T14:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to human readable format at index time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463189#M130578</link>
      <description>&lt;P&gt;I was not understanding how Splunk assigns timestamps but after reading your responses and doing some testing, I figured it out. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:30:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-human-readable-format-at-index-time/m-p/463189#M130578</guid>
      <dc:creator>ricotries</dc:creator>
      <dc:date>2020-02-06T16:30:47Z</dc:date>
    </item>
  </channel>
</rss>

