Splunk Search

What is the best way to format _time when values become unreadable after transpose?

packet_hunter
Contributor

So I have to queries...

First one gives me a normal time/date format which is human-readable i.e. (2017-10-05 15:20:27 )

index=fireeye sourcetype=nx_json  | stats  list(appliance) as Appliance list(alert.src.host) as Source_Host list(alert.src.ip) as Source_IP list(alert.dst.ip) as Dest_IP list(alert.explanation.malware-detected.malware.name) as Explanation by _time 

Second one gives me a machine format for time/date i.e. (1507234827)

index=fireeye sourcetype=nx_json  | stats  list(appliance) as Appliance list(alert.src.host) as Source_Host list(alert.src.ip) as Source_IP list(alert.dst.ip) as Dest_IP list(alert.explanation.malware-detected.malware.name) as Explanation by _time  | transpose | rename column as Details, row* as occurrence*

The difference is that I transpose the output...

Does anyone know why this happens?... and what is the best way to correct this?

Thank you

Tags (3)
0 Karma
1 Solution

DalJeanis
Legend

The variable _time is special. It is actually stored in epoch time, but it is displayed in human-readable format.

Do this before the transpose:

| eval _time = strftime(_time,"%Y-%m-%d %H:%M:%S.%3N"
| rename _time as Time

You can see the time format variables here, if you want to make it some other format.

https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Commontimeformatvariables

View solution in original post

DalJeanis
Legend

The variable _time is special. It is actually stored in epoch time, but it is displayed in human-readable format.

Do this before the transpose:

| eval _time = strftime(_time,"%Y-%m-%d %H:%M:%S.%3N"
| rename _time as Time

You can see the time format variables here, if you want to make it some other format.

https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Commontimeformatvariables

Get Updates on the Splunk Community!

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...