<?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: Special epoch timestamp recognition in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28357#M4836</link>
    <description>&lt;P&gt;Hmm. Tricky. Is it possible to make a &lt;CODE&gt;TRANSFORM&lt;/CODE&gt; on &lt;CODE&gt;_time&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;It would require that you set your &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; to include the &lt;CODE&gt;"1."&lt;/CODE&gt;-part of the timestamp. And then set the &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt; to &lt;CODE&gt;%s%3N&lt;/CODE&gt;. That would give you a timestamp in early 1980's. &lt;/P&gt;

&lt;P&gt;Then with a &lt;CODE&gt;TRANSFORM&lt;/CODE&gt; on &lt;CODE&gt;_time&lt;/CODE&gt; you add the starting "1" (and perhaps remove the millisecond part)... &lt;/P&gt;

&lt;P&gt;I have not done this before, so take it as a theory that might be worth investigating. Perhaps this is not at all possible. It's at times like these I wish I knew all of the parsing/indexing phase processors by heart, and in which order they come.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;From the docs on transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FORMAT = &amp;lt;string&amp;gt;
* NOTE: This option is valid for both index-time and search-time field extraction. However, FORMAT 
  behaves differently depending on whether the extraction is performed at index time or 
  search time.
* This attribute specifies the format of the event, including any field names or values you want 
  to add.
* FORMAT for index-time extractions:
    * Use $n (for example $1, $2, etc) to specify the output of each REGEX match. 
    * If REGEX does not have n groups, the matching fails. 
    * The special identifier $0 represents what was in the DEST_KEY before the REGEX was performed.
    * At index time only, you can use FORMAT to create concatenated fields:
        * FORMAT = ipaddress::$1.$2.$3.$4
    * When you create concatenated fields with FORMAT, "$" is the only special character. It is 
      treated as a prefix for regex-capturing groups only if it is followed by a number and only 
      if the number applies to an existing capturing group. So if REGEX has only one capturing 
      group and its value is "bar", then:
        * "FORMAT = foo$1" yields "foobar"
        * "FORMAT = foo$bar" yields "foo$bar"
        * "FORMAT = foo$1234" yields "foo$1234"
        * "FORMAT = foo$1\$2" yields "foobar\$2"
    * At index-time, FORMAT defaults to &amp;lt;stanza-name&amp;gt;::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps a little,&lt;/P&gt;

&lt;P&gt;K&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Update:&lt;/P&gt;

&lt;P&gt;Hi K,&lt;BR /&gt;
you sent me in the right direction. This works without the subsecond part:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[epo]
TRANSFORMS-epo=epo

transforms.conf
[epo]
DEST_KEY = _time
#This doesn't work
#REGEX =  (1)\.(\d{12})E9
#This does work
REGEX =  (1)\.(\d{9})\d{3}E9
FORMAT = $1$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Aug 2013 10:59:13 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2013-08-08T10:59:13Z</dc:date>
    <item>
      <title>Special epoch timestamp recognition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28356#M4835</link>
      <description>&lt;P&gt;Can Splunk somehow recognize the following timestamp format: 1.375944219123E9&lt;/P&gt;

&lt;P&gt;It is the epoch time written in float exponential notation with milliseconds&lt;/P&gt;

&lt;P&gt;I did not see that  &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Configuretimestamprecognition#Enhanced_strptime.28.29_support"&gt;strptime&lt;/A&gt; supports this format&lt;/P&gt;

&lt;P&gt;I then thought that I could just get rid of the "." using SEDCMD in props.conf but it is only executed after the timestamp recognition&lt;/P&gt;

&lt;P&gt;Aaand I think it is not possible to write a custom datetime.xml that somehow drops the "." because it is regex based and you can't just drop the "." in a capturing group, but I might be wrong.&lt;/P&gt;

&lt;P&gt;Any Ideas? Also a confirmation that it is not possible to read this format would help.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2013 06:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28356#M4835</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2013-08-08T06:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Special epoch timestamp recognition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28357#M4836</link>
      <description>&lt;P&gt;Hmm. Tricky. Is it possible to make a &lt;CODE&gt;TRANSFORM&lt;/CODE&gt; on &lt;CODE&gt;_time&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;It would require that you set your &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; to include the &lt;CODE&gt;"1."&lt;/CODE&gt;-part of the timestamp. And then set the &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt; to &lt;CODE&gt;%s%3N&lt;/CODE&gt;. That would give you a timestamp in early 1980's. &lt;/P&gt;

&lt;P&gt;Then with a &lt;CODE&gt;TRANSFORM&lt;/CODE&gt; on &lt;CODE&gt;_time&lt;/CODE&gt; you add the starting "1" (and perhaps remove the millisecond part)... &lt;/P&gt;

&lt;P&gt;I have not done this before, so take it as a theory that might be worth investigating. Perhaps this is not at all possible. It's at times like these I wish I knew all of the parsing/indexing phase processors by heart, and in which order they come.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;From the docs on transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FORMAT = &amp;lt;string&amp;gt;
* NOTE: This option is valid for both index-time and search-time field extraction. However, FORMAT 
  behaves differently depending on whether the extraction is performed at index time or 
  search time.
* This attribute specifies the format of the event, including any field names or values you want 
  to add.
* FORMAT for index-time extractions:
    * Use $n (for example $1, $2, etc) to specify the output of each REGEX match. 
    * If REGEX does not have n groups, the matching fails. 
    * The special identifier $0 represents what was in the DEST_KEY before the REGEX was performed.
    * At index time only, you can use FORMAT to create concatenated fields:
        * FORMAT = ipaddress::$1.$2.$3.$4
    * When you create concatenated fields with FORMAT, "$" is the only special character. It is 
      treated as a prefix for regex-capturing groups only if it is followed by a number and only 
      if the number applies to an existing capturing group. So if REGEX has only one capturing 
      group and its value is "bar", then:
        * "FORMAT = foo$1" yields "foobar"
        * "FORMAT = foo$bar" yields "foo$bar"
        * "FORMAT = foo$1234" yields "foo$1234"
        * "FORMAT = foo$1\$2" yields "foobar\$2"
    * At index-time, FORMAT defaults to &amp;lt;stanza-name&amp;gt;::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps a little,&lt;/P&gt;

&lt;P&gt;K&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Update:&lt;/P&gt;

&lt;P&gt;Hi K,&lt;BR /&gt;
you sent me in the right direction. This works without the subsecond part:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[epo]
TRANSFORMS-epo=epo

transforms.conf
[epo]
DEST_KEY = _time
#This doesn't work
#REGEX =  (1)\.(\d{12})E9
#This does work
REGEX =  (1)\.(\d{9})\d{3}E9
FORMAT = $1$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Aug 2013 10:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28357#M4836</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-08T10:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Special epoch timestamp recognition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28358#M4837</link>
      <description>&lt;P&gt;glad to hear that it worked...&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 20:44:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Special-epoch-timestamp-recognition/m-p/28358#M4837</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-13T20:44:51Z</dc:date>
    </item>
  </channel>
</rss>

