Splunk Search

Why does strptime not parse timestamps to nanoseconds (%9N/%9Q)?

andrewtrobec
Motivator

Splunk Enterprise 9.0.5.1

Hello!

I have to calculate the delta between two timestamps that have nanosecond granularity.  According to Splunk documentation nanoseconds are supported with either %9N or %9Q: https://docs.splunk.com/Documentation/Splunk/9.0.5/SearchReference/Commontimeformatvariables

andrewtrobec_0-1698327144862.png


When I try to parse a timestamp with nanosecond granularity, however, it stops at microseconds and calculates the delta in microseconds as well.  My expectation is that Splunk should maintain and manage nanoseconds.

Here is a run anywhere:

 

 

 

| makeresults
| eval start = "2023-10-24T18:09:24.900883123"
| eval end = "2023-10-24T18:09:24.902185512"
| eval start_epoch = strptime(start,"%Y-%m-%dT%H:%M:%S.%9N")
| eval end_epoch = strptime(end,"%Y-%m-%dT%H:%M:%S.%9N")
| table start end start* end*
| eval delta = end_epoch - start_epoch
| eval delta_round = round(end_epoch - start_epoch,9)

 

 

 


Is this a defect or am I doing something wrong?

Thank you!

Andrew

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Looks like a defect to me

Get Updates on the Splunk Community!

Splunk Search APIを使えば調査過程が残せます

   このゲストブログは、JCOM株式会社の情報セキュリティ本部・専任部長である渡辺慎太郎氏によって執筆されました。 Note: This article is published in both Japanese ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...