Splunk Search

When displaying events in a table, can I change the timeformat used to render the times?

sideview
SplunkTrust
SplunkTrust

In a dashboard we're working with we are displaying a table of events and the times always have 000 as the millisecond values so we dont want to waste space showing those. And we really dont need to show the year either. Probably not even the month or the day because the header says that these are all from the last few hours. Basically any space we can save on this dashboard would be great.

So is there a way that I can reformat the big times like "12/31/00 4:00:00.000 PM" ?

Tags (3)
1 Solution

sideview
SplunkTrust
SplunkTrust

Sure, although you have to realize that the values of _time are actually epochtime numbers like '1271171831.033'. The table and the events viewer UI always show _time as though the field was a string value but this is just because the UI handling that _time field specially.

You can prove this by tacking on | eval foo=_time to your search (and selecting 'foo' in the field picker popup so the 'foo' field then shows up).

But anway, you can use the convert command to convert from epochtimes to string formatted times.

index=_internal | head 3 | convert timeformat="%H:%M:%S" ctime(_time) as compact_time

That will print out a much more compact time value like "08:19:21"

(Again, if you test this in the main search UI make sure to open the Field Picker and select the 'compact_time' field or else nothing will show up. )

View solution in original post

sideview
SplunkTrust
SplunkTrust

Sure, although you have to realize that the values of _time are actually epochtime numbers like '1271171831.033'. The table and the events viewer UI always show _time as though the field was a string value but this is just because the UI handling that _time field specially.

You can prove this by tacking on | eval foo=_time to your search (and selecting 'foo' in the field picker popup so the 'foo' field then shows up).

But anway, you can use the convert command to convert from epochtimes to string formatted times.

index=_internal | head 3 | convert timeformat="%H:%M:%S" ctime(_time) as compact_time

That will print out a much more compact time value like "08:19:21"

(Again, if you test this in the main search UI make sure to open the Field Picker and select the 'compact_time' field or else nothing will show up. )

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...