Getting Data In

Epoch Time - Time Stamp Assignment with Millisecs seperate in JSON

jimdiconectiv
Path Finder

I have some passive dns data that has time stamps that look like this in JSON logs:

{"timestamp":"2021-10-21 16:31:01","timestamp_s":1634833861,"timestamp_ms":973448, 

So it has first conventional time stamp and then a full seconds based Unix Epoch Time Stamp in seconds followed by:

timestamp_ms":990877

This has the millsecs of the time only (actually microseconds).  The more convention time would have been:

timestamp_s":1634834347.990877 

I have not been able to get the time to include the millisec value included so far.  I am using a TIME_PREFIX that should skip the conventional timestamp.   Most recently, I used SEDCMD to get the time stamp to look more normal for epoch time --- timestamp_s":1634834347.990877,  but maybe the SEDCMD only happens after the time stamp is determined.

I have used similar to for this.

TIME_PREFIX=timestamp_s":
TIME_FORMAT= %s.%6N

Any help appreciated ! 

 

 

 

Labels (2)
0 Karma

johnhuang
Motivator

TIME_PREFIX = timestamp_s\x22:
TIME_FORMAT = %s,\"timestamp_ms\":%6N

0 Karma

Siddharth
Path Finder

Hi jimmy ,

So i think just index the data using first time stamp in temp index then write a spl to extract this info and push the new data inside your desired index .

you can also set retention time 2-3 weeks in temp index

jimdiconectiv
Path Finder

Thanks for the thought.  A possible solution.  I'll update.  

I had hoped I could just get strptime to skip around the stuff between the secs part of the epoch time and the ms part, TIME_FORMAT = %s,\"timestamp_ms\":%6N,  but that did not work -- You can put slashes colon and other punctuation in there but I guess no strings. 

I also tried fixing the time stamp to a pure seconds and ms part doing a rewrite with SEDCMD, that worked to re-write the record,  but did not fix the time stamp which is determined before. 

0 Karma

jimdiconectiv
Path Finder

I don't think I have previously had a post up for this long and gotten no answers.   PLEASE ! 

0 Karma

jimdiconectiv
Path Finder

Please help !   I normall get help after posting.  This is an important issue for us. 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...