Splunk Search

How to Convert Epoch Time?

itsmevic
Communicator

I'm running the below query to find out when was the last time an index checked in. However, in using this query the output reflects a time format that is in EPOC format. I'd like to convert it to a standard month/day/year format. Any help is appreciated. Thank you.

| tstats latest(_time) WHERE index=* BY index
Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

There are several ways to do that.

Start with | tstats latest(_time) as time WHERE index=* BY index then add your choice of

| eval time = strftime(time, "%c")

| convert ctime(time)

| fieldformat time = strftime(time, "%c")

---
If this reply helps you, Karma would be appreciated.

View solution in original post

to4kawa
Ultra Champion

see https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables

month/day/year format is %x

but

| tstats latest(_time) as _time WHERE index=* BY index

This is enough.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

There are several ways to do that.

Start with | tstats latest(_time) as time WHERE index=* BY index then add your choice of

| eval time = strftime(time, "%c")

| convert ctime(time)

| fieldformat time = strftime(time, "%c")

---
If this reply helps you, Karma would be appreciated.

sxpati2
Engager

This works for me: | eval time = strftime(time, "%c")

Tags (1)
0 Karma

sxpati2
Engager

index=prd* /inf/bnkng/evnt/arrngmntorigevnt/consumr/mrtgeorig/v1/submissions/*/applications/submissionView "includeHomeInsuranceDetails=Y" ssl_client_verify= SUCCESS|table request, time|eval time = strftime(time, "%c")

 

Result:

 

GET /inf/bnkng/evnt/arrngmntorigevnt/consumr/mrtgeorig/v1/submissions/SUB501460231068589/applications/submissionView?brandSilo=ANZYU&includeHomeInsuranceDetails=Y HTTP/1.1Sun Mar 26 08:09:28 2023
GET /inf/bnkng/evnt/arrngmntorigevnt/consumr/mrtgeorig/v1/submissions/SUB503765231068589/applications/submissionView?brandSilo=ANZYD&includeHomeInsuranceDetails=Y HTTP/1.1Sun Mar 26 08:28:09 2023

 

 

0 Karma

itsmevic
Communicator

Using the following worked:

| tstats latest(_time) as time WHERE index=* BY index
| eval time=strftime(time, "%c")

Thank you!

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...