<?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: transforming timestamps in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80716#M16653</link>
    <description>&lt;P&gt;Your &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt; looks OK, but your timestamp is pretty far into the event so it's past the default limit of how long into an event Splunk looks for timestamps. Default value is 150 characters - in your sample event the timestamp starts at the 244th character so you'll want to increase the limit by specifying &lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD&lt;/CODE&gt; for this sourcetype in props.conf.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/admin/Propsconf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2013 12:29:06 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2013-10-03T12:29:06Z</dc:date>
    <item>
      <title>transforming timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80713#M16650</link>
      <description>&lt;P&gt;We have JSON data coming into Splunk. When it appears in Splunk the events shows a timestamp like &lt;BR /&gt;
10/2/13&lt;BR /&gt;
7:07:26.000 PM&lt;/P&gt;

&lt;P&gt;Whereas the actual time stamp of when the even was generated is in the JSON as &lt;BR /&gt;
{&lt;BR /&gt;
 ...&lt;BR /&gt;&lt;BR /&gt;
  timestamp : "03-Oct-2013,02:07:23:27,UTC",&lt;BR /&gt;
 ...&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;I would like splunk to use the timestamp in the json as the default time stamp so that we can sort by that.&lt;/P&gt;

&lt;P&gt;Otherwise users have to search using an expression as follows &lt;BR /&gt;
... | spath "timestamp" |eval t=strptime(timestamp,"%d-%b-%Y,%H:%M:%S:%2N,%Z")|sort t&lt;/P&gt;

&lt;P&gt;Which is a pain.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;:&lt;/P&gt;

&lt;P&gt;In etc/system/local/transforms.conf I have defined&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[date-transform]
REGEX = \{*.timestamp\":\"(\w{2})-(\w{3})-(\w{4}),(\w{2}):(\w{2}):(\w{2}):(\w{2}),(\w{3})*.
FORMAT=$1-$2-$3,$4:$5:$6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In etc/system/local/props.conf I have defined&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[log4j]
TRANSFORMS-dttransform=date-transform
TIME_FORMAT = %d-%b-%Y,%H:%M:%S
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The JSON is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"message":{"request_method": "GET","request_headers": {"host": "localhost:8080"},"params": {"type": "[dbdbdbdb]"},"request_body": "",        "request_url": "http:\/\/localhost:8080\/a"},"sourceClass": "class1",    "tenantId": 0,"timestamp": "03-Oct-2013,16:34:53:63,UTC","sourceId": -1}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it doesnt seem to work. The time stamp on the left continues to be different from the JSON timestamp. In transform.conf what should be the dest_key ??  &lt;/P&gt;

&lt;P&gt;Suggestion?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 02:25:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80713#M16650</guid>
      <dc:creator>amanteja</dc:creator>
      <dc:date>2013-10-03T02:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: transforming timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80714#M16651</link>
      <description>&lt;P&gt;you need to put regx in transforms.conf and props.conf ...&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 05:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80714#M16651</guid>
      <dc:creator>kml_uvce</dc:creator>
      <dc:date>2013-10-03T05:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: transforming timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80715#M16652</link>
      <description>&lt;P&gt;Take a look at this:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.5/Data/ConfigurePositionalTimestampExtraction" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.5/Data/ConfigurePositionalTimestampExtraction&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You'll need to change your MAX_TIMESTAMP_LOOKAHEAD and TIME_PREFIX in your props.conf for that sourcetype (or source/host if you want it that granular).  So, how far to look into the event for the timestamp and then a regex to tell splunk to look for that before extracting a timestamp.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80715#M16652</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2020-09-28T14:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: transforming timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80716#M16653</link>
      <description>&lt;P&gt;Your &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt; looks OK, but your timestamp is pretty far into the event so it's past the default limit of how long into an event Splunk looks for timestamps. Default value is 150 characters - in your sample event the timestamp starts at the 244th character so you'll want to increase the limit by specifying &lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD&lt;/CODE&gt; for this sourcetype in props.conf.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/admin/Propsconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 12:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80716#M16653</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-10-03T12:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: transforming timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80717#M16654</link>
      <description>&lt;P&gt;Thanks. Finally the fix was that&lt;BR /&gt;
 1. I modified the JSON log to always have the timestamp in the beginning (so no need to define the MAX_TIMESTAMP_LOOKAHEAD)&lt;BR /&gt;
 2. Then in etc/system/local/props.conf I defined the TIME_FORMAT = %d-%b-%Y,%H:%M:%S&lt;/P&gt;

&lt;P&gt;Dont need any transform.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:53:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/transforming-timestamps/m-p/80717#M16654</guid>
      <dc:creator>amanteja</dc:creator>
      <dc:date>2020-09-28T14:53:28Z</dc:date>
    </item>
  </channel>
</rss>

