<?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 do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395780#M70577</link>
    <description>&lt;P&gt;@PowerPacked Thanks, but that didn't work either&lt;/P&gt;</description>
    <pubDate>Sat, 23 Feb 2019 16:42:45 GMT</pubDate>
    <dc:creator>emillg</dc:creator>
    <dc:date>2019-02-23T16:42:45Z</dc:date>
    <item>
      <title>How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395776#M70573</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;When sending logs to Splunk Cloud via HTTP Event Collector, Splunk was not able to extract the correct timestamp from the "date" field. But, when I uploaded the logs as a file, Splunk extracted the correct timestamp automatically.&lt;/P&gt;

&lt;P&gt;Can someone help? Thanks!&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6565i987B1B48958EFF81/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 20:27:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395776#M70573</guid>
      <dc:creator>emillg</dc:creator>
      <dc:date>2019-02-22T20:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395777#M70574</link>
      <description>&lt;P&gt;@emillg - Check the sourcetype used for HEC and accordingly update the TIMESTAMP configuration in props.conf or by editing sourcetype.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 20:38:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395777#M70574</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-02-22T20:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395778#M70575</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80230"&gt;@Vijeta&lt;/a&gt; &lt;BR /&gt;
I have tried the following in sourcetype, but didn't work. Did I miss something?&lt;/P&gt;

&lt;P&gt;TIME_PREFIX = \"date\":\"&lt;BR /&gt;
MAX_TIMESTAMP_LOOKAHEAD = 24&lt;/P&gt;

&lt;P&gt;The raw text log looks like&lt;/P&gt;

&lt;P&gt;{"message":{"date":"2019-02-19T21:32:45.743Z","type":"XXX","description":"","connection_id":"","client_id":"XXX","client_name":"XXX","ip":"XXX","user_agent":"XXX","hostname":"XXX","user_id":"","user_name":"","audience":"XXX","scope":null,"auth0_client":{"name":"auth0-java","version":"1.0.0"},"_id":"XXX","log_id":"XXX","isMobile":false},"severity":"info"}&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:20:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395778#M70575</guid>
      <dc:creator>emillg</dc:creator>
      <dc:date>2020-09-29T23:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395779#M70576</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Give this a try&lt;/P&gt;

&lt;P&gt;INDEXED_EXTRACTIONS = JSON&lt;BR /&gt;
TIMESTAMP_FIELDS = date&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395779#M70576</guid>
      <dc:creator>PowerPacked</dc:creator>
      <dc:date>2020-09-29T23:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395780#M70577</link>
      <description>&lt;P&gt;@PowerPacked Thanks, but that didn't work either&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 16:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395780#M70577</guid>
      <dc:creator>emillg</dc:creator>
      <dc:date>2019-02-23T16:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395781#M70578</link>
      <description>&lt;P&gt;You need to figure out what &lt;CODE&gt;sourceytpe&lt;/CODE&gt; is being used for these events.  Then you need to create a &lt;CODE&gt;sourcetype-based&lt;/CODE&gt; stanza in props.conf like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourcetypeHere]
TIME_PREFIX = 
TIME_FORMAT = 
MAX_TIMESTAMP_LOOKAHEAD = 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NOTE: If you have overridden the sourcetype anywhere, use the ORIGINAL sourcetype, not the new/overwritten value.&lt;/P&gt;

&lt;P&gt;Deploy this to the first full instance of Splunk that handles the events (Heavy Forwarder tier or Indexer tier).&lt;BR /&gt;
Restart all Splunk instances there.&lt;BR /&gt;
Send in new data (old events will stay forever broken).&lt;BR /&gt;
Be sure that you are looking at the new events by using &lt;CODE&gt;All time&lt;/CODE&gt; in your timepicker and &lt;CODE&gt;index_earliest=-5m&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 19:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395781#M70578</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-23T19:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395782#M70579</link>
      <description>&lt;P&gt;I had the same problem. This has to do with the end point used to send the data to the HEC; there are two of them, one is the "event" end point, and the 2nd is the "raw" end point. If you are sending data to the "event" end point then you will not be able to parse the data before indexing (to use props and transforms), this is by design, basically, Splunk considers that everything being sent to the "event" end point is properly formatted and it will go directly to indexing. If you want Splunk to get the correct time stamp, you need to make sure that the "time" met key is configured in the payload sent to Splunk, and the value needs to be in epoch format, when you do this, you will get the correct time stamp for your events. Other met keys tha can be used are: index, source, sourcetype.&lt;BR /&gt;
Here is a curl command that you can use to test sending data to the HEC via the "event" end point:&lt;BR /&gt;
curl -k -u "x:" "https://:8088/services/collector/event" -d '{"time":"1587590959", "index":"test","sourcetype": "mysourcetype", "event": "Testing events, Testing events!"}'&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 17:56:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/395782#M70579</guid>
      <dc:creator>hernanb</dc:creator>
      <dc:date>2020-04-28T17:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/547461#M91116</link>
      <description>&lt;P&gt;Did you ever get this working?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 23:03:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/547461#M91116</guid>
      <dc:creator>swebb07g</dc:creator>
      <dc:date>2021-04-09T23:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/572055#M101258</link>
      <description>&lt;P&gt;I don't know how to fully solve the OP's issue, but I did figure out how to do it with an epoch that's showing up in the event.&lt;/P&gt;&lt;P&gt;Using an IDX transform on the sourcetype.&amp;nbsp; &amp;nbsp;(For me, I had the epoch time at the start of _raw.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[set_x-balancer_time]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SOURCE_KEY = _raw&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;REGEX = ^(\d{10}\.?\d*)\s&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FORMAT = $1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEST_KEY = _time&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;DEST_KEY = _time&amp;nbsp; - requires the timestamp to be in epoch format, so in order to get that to work with another timestamp you'd have to find a way to change it into epoch.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 17:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/572055#M101258</guid>
      <dc:creator>jason12vb</dc:creator>
      <dc:date>2021-10-22T17:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/572056#M101259</link>
      <description>&lt;P&gt;With event endpoint there is an assumption that the time has already been parsed out and is supplied as time field along with the event data. The event therefore bypasses some steps of parsing queue (timestamp recognition, line breaking) effectively lowering load on the indexer/HF.&lt;/P&gt;&lt;P&gt;But since, I think, 8.0 you can add ?auto_extract_timestamp=true to the endpoint url and the event will go through timestamp parsing phase.&lt;/P&gt;&lt;P&gt;See &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/Data/HECRESTendpoints" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.2/Data/HECRESTendpoints&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 17:30:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/572056#M101259</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-10-22T17:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract a timestamp from JSON logs that are being sent to an HTTP Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/572074#M101262</link>
      <description>&lt;P&gt;Thanks for the suggestion, I'll try that out.&amp;nbsp; Not sure how much control I have over the dynamic creation of the curl commands generated though to know whether or not I can send events that need it and not for those that don't.&lt;/P&gt;&lt;P&gt;In my case, I'm using Splunk Connect for Syslog (SC4S).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 18:52:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-a-timestamp-from-JSON-logs-that-are-being/m-p/572074#M101262</guid>
      <dc:creator>jason12vb</dc:creator>
      <dc:date>2021-10-22T18:52:38Z</dc:date>
    </item>
  </channel>
</rss>

