<?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 Timestamp Parsing in JSON in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216641#M42632</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can anyone help me with best configurations for timestamp parsing  (where "&lt;STRONG&gt;DateTime&lt;/STRONG&gt;" is the actual time) for following JSON format :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ [-] 
    AccessKey:  ----------------------
    Account:  some-value
    AccountId:  somevalue
    Action:  GetInstances 
    Class:  ----------------------------------------------------------
    **DateTime:  2007-10-27T00:51:57.91Z** 
    ElapsedTime:  00:00:00 
    File:  null 
    Level:  Trace 
    Line:  null 
    LogId:  ID-347t58734534-6565ghmhmm
    Message:  Vapor URL - &lt;A href="https://www.randomURL.com,ImageId)" target="test_blank"&gt;https://www.randomURL.com,ImageId)&lt;/A&gt;
Header - {
  "Signature": "$^%$#@)(#4t4r65gvjhloojk",
  "AccessKey": "123854y3957349534-0fdjvbkjds90234u02394-23940=dsffsvbkdjadsvfnk0923480",
  "RequestType": 0,
  "SkipOwnerLookup": false,
  "UserAgent": "456934",
  "UserAgentVersion": null,
  "Timestamp": "2007-10-27T00:51:57Z",
  "User": "3254832564873`12",
  "TestMode": false,
  "ScheduledAction": false
} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I have already tried in props.conf is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[API]
TIMESTAMP_FIELDS=DateTime 
INDEXED_EXTRACTIONS=json
NO_BINARY_CHECK=true
KV_MODE=none 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And also:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[API]
TIME_PREFIX = "\"DateTime\":\"
INDEXED_EXTRACTIONS=json
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I have been through the link:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/104500/transforming-timestamps.html"&gt;https://answers.splunk.com/answers/104500/transforming-timestamps.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;None of the two seem to be working. Any comments/ suggestions will be highly appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2015 06:15:01 GMT</pubDate>
    <dc:creator>RichaSingh</dc:creator>
    <dc:date>2015-11-02T06:15:01Z</dc:date>
    <item>
      <title>Timestamp Parsing in JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216641#M42632</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can anyone help me with best configurations for timestamp parsing  (where "&lt;STRONG&gt;DateTime&lt;/STRONG&gt;" is the actual time) for following JSON format :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ [-] 
    AccessKey:  ----------------------
    Account:  some-value
    AccountId:  somevalue
    Action:  GetInstances 
    Class:  ----------------------------------------------------------
    **DateTime:  2007-10-27T00:51:57.91Z** 
    ElapsedTime:  00:00:00 
    File:  null 
    Level:  Trace 
    Line:  null 
    LogId:  ID-347t58734534-6565ghmhmm
    Message:  Vapor URL - &lt;A href="https://www.randomURL.com,ImageId)" target="test_blank"&gt;https://www.randomURL.com,ImageId)&lt;/A&gt;
Header - {
  "Signature": "$^%$#@)(#4t4r65gvjhloojk",
  "AccessKey": "123854y3957349534-0fdjvbkjds90234u02394-23940=dsffsvbkdjadsvfnk0923480",
  "RequestType": 0,
  "SkipOwnerLookup": false,
  "UserAgent": "456934",
  "UserAgentVersion": null,
  "Timestamp": "2007-10-27T00:51:57Z",
  "User": "3254832564873`12",
  "TestMode": false,
  "ScheduledAction": false
} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I have already tried in props.conf is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[API]
TIMESTAMP_FIELDS=DateTime 
INDEXED_EXTRACTIONS=json
NO_BINARY_CHECK=true
KV_MODE=none 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And also:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[API]
TIME_PREFIX = "\"DateTime\":\"
INDEXED_EXTRACTIONS=json
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I have been through the link:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/104500/transforming-timestamps.html"&gt;https://answers.splunk.com/answers/104500/transforming-timestamps.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;None of the two seem to be working. Any comments/ suggestions will be highly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 06:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216641#M42632</guid>
      <dc:creator>RichaSingh</dc:creator>
      <dc:date>2015-11-02T06:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp Parsing in JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216642#M42633</link>
      <description>&lt;P&gt;If that's an accurate copy/paste of the data you're attempting to send in, that is not actually &lt;A href="http://json.org" target="_blank"&gt;JSON formatted text&lt;/A&gt;. It's close, but not quite. This could definitely throw a wrench into using INDEXED_EXTRACTIONS. If it was actually JSON text there would be a lot more double quotes at least.&lt;/P&gt;

&lt;P&gt;If you're using &lt;CODE&gt;INDEXED_EXTRACTIONS=json&lt;/CODE&gt; with your sourcetype, the props.conf stanza specifying INDEXED_EXTRACTIONS and all parsing options should live on the originating Splunk instance instead of the usual parsing Splunk instance. (In most environments, this means this configuration is on your universal forwarder instead of your indexer). I would try &lt;CODE&gt;TIMESTAMP_FIELDS&lt;/CODE&gt; on the UF (assuming you can actually use &lt;CODE&gt;INDEXED_EXTRACTIONS&lt;/CODE&gt;.)&lt;/P&gt;

&lt;P&gt;If you cannot use INDEXED_EXTRACTIONS, don't surround your setting of TIME_PREFIX in quotes. You should also consider also setting TIME_FORMAT and MAX_TIMESTAMP_LOOKAHEAD if the timestamp is consistent. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:44:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216642#M42633</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2020-09-29T07:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp Parsing in JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216643#M42634</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
got a similar problem at an customer and worked yesterday on a solution based on your Question and the first answer, on a testsetup.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://oc.plugiat.net/index.php/apps/files_sharing/ajax/publicpreview.php?x=1280&amp;amp;y=362&amp;amp;a=true&amp;amp;file=Bildschirmfoto%25202016-09-30%2520um%252007.37.30.png&amp;amp;t=uSB5gLkm2lgokr1&amp;amp;scalingup=0" alt="Rebuild Timestamp" /&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="As raw"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/795i035B48F9D18FE4C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="As raw" alt="As raw" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The Splunk Server has a different system time than the sender (see in the lower half)&lt;/P&gt;

&lt;P&gt;The JSON is send by following python line:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;response = urllib2.urlopen(req, json.dumps({"sourcetype":"indoor_tph", "source":"", "host":"", "event": {"temperature": str(sense.get_temperature()-7.0), "timestamp": str(datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%f')), "pressure": str(sense.get_pressure()), "humidity": str(sense.get_humidity())}}))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The props.conf entry for the upper half example looks:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[indoor_tph]
INDEXED_EXTRACTIONS = JSON
TIME_PREFIX = "timestamp": "
TIME_FORMAT = %Y-%m-%dT%H:%M:%S.%6N
TZ = UTC
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this will help other splunkers with the same or similar problems.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;BR /&gt;
SierraX&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 05:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamp-Parsing-in-JSON/m-p/216643#M42634</guid>
      <dc:creator>SierraX</dc:creator>
      <dc:date>2016-09-30T05:55:01Z</dc:date>
    </item>
  </channel>
</rss>

