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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...