Splunk Search

Change the 'oldest' and 'latest' field values to readible time format using 'strptime' command

lawannapage
New Member

I'm having trouble changing the 'oldest' and 'latest' field values from epoch time to readible time format using 'strptime' command:

| dbinspect index= | stats min(startEpoch) as oldest max(endEpoch) as latest by index | join type=outer [| rest /services/data/indexes/ | fields title currentDBSizeMB frozenTimePeriodInSecs maxTotalDataSizeMB | rename title as index] | eval premature_aging=if(((now() - 188697600)*1.1) < oldest,"smoke…fire?","aging nicely")

I would appreciate if anyone could help me out.

0 Karma

somesoni2
Revered Legend

The command to use here is strftime (epoch to string) not strptime (string to epoch), or use convert command's ctime funtion.

Try like this

| dbinspect index= | stats min(startEpoch) as oldest max(endEpoch) as latest by index | join type=outer [| rest /services/data/indexes/ | fields title currentDBSizeMB frozenTimePeriodInSecs maxTotalDataSizeMB | rename title as index] | eval premature_aging=if(((now() - 188697600)*1.1) < oldest,"smoke…fire?","aging nicely") | convert ctime(oldest) ctime(latest) timeformat="%F %T"
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...