<?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 a time field with multiple formats to epoch at search-time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201830#M58507</link>
    <description>&lt;P&gt;The generalized assumption in this question is that the formats cannot be known in advance or are too many to configure manually.  Also that the time fields are not the ones that Splunk turns into _time or that we want to catch them before Splunk applies its own time conversion functions to the field.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2015 21:13:56 GMT</pubDate>
    <dc:creator>landen99</dc:creator>
    <dc:date>2015-11-02T21:13:56Z</dc:date>
    <item>
      <title>How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201824#M58501</link>
      <description>&lt;P&gt;How do I take a time field with multiple human-readable formats and get the epoch time at search-time?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 11:48:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201824#M58501</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2015-10-28T11:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201825#M58502</link>
      <description>&lt;P&gt;What do you mean by "multiple human-readable formats"?  Is the format unknown at search time?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 11:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201825#M58502</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-10-28T11:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201826#M58503</link>
      <description>&lt;P&gt;Please provide a sample of what your events look like (with the fields of interest highlighted), and what you'd like to see&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 15:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201826#M58503</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-10-28T15:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201827#M58504</link>
      <description>&lt;P&gt;If your string formatted time is of the form "2015-10-28 08:52:41",  then &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval epochTime=strptime(timeStr, "%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need to convert multiple formats, you'll need multiple eval clauses. &lt;/P&gt;

&lt;P&gt;docs for all of the functions that eval can use:   &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You'll also probably find the quick reference guide handy. Note the last page which has all the common timeformat %X values. &lt;BR /&gt;
&lt;A href="https://www.splunk.com/web_assets/pdfs/secure/Splunk_Quick_Reference_Guide.pdf"&gt;https://www.splunk.com/web_assets/pdfs/secure/Splunk_Quick_Reference_Guide.pdf&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;And at pretty much any splunk event  they often hand the reference cards out on 8.5"x11" cardstock.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 16:27:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201827#M58504</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2015-10-28T16:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201828#M58505</link>
      <description>&lt;P&gt;Splunk really needs a search command to allow users to pass a timestamp through &lt;CODE&gt;$SPLUNK_HOME/etc/system/default/datetime.xml&lt;/CODE&gt;.  But since that doesn't work you will have to use &lt;CODE&gt;coalesce&lt;/CODE&gt;, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval epochTime=colesce(strptime(timeStr, "&amp;lt;format 1&amp;gt;"), strptime(timeStr, "&amp;lt;format 2&amp;gt;"), ..., strptime(timeStr, "&amp;lt;format n&amp;gt;"))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2015 15:25:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201828#M58505</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-29T15:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201829#M58506</link>
      <description>&lt;P&gt;I wasn't sure that coalesce would work with more than two.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 19:28:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201829#M58506</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2015-11-02T19:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a time field with multiple formats to epoch at search-time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201830#M58507</link>
      <description>&lt;P&gt;The generalized assumption in this question is that the formats cannot be known in advance or are too many to configure manually.  Also that the time fields are not the ones that Splunk turns into _time or that we want to catch them before Splunk applies its own time conversion functions to the field.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 21:13:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-time-field-with-multiple-formats-to-epoch-at/m-p/201830#M58507</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2015-11-02T21:13:56Z</dc:date>
    </item>
  </channel>
</rss>

