Splunk Search

Adding column to timechart table.

sflunk
Engager

I wanted to add my converted Time to a timechart, but don't know how.

|convert ctime(_time) AS Time
|eval Time=strftime(_time, "%m/%d/%Y %H:%M:%S")
|timechart distinct_count(Stuff)

This will give me a table with the default _time value and I wanted to add Time to the timechart and remove the default _time column - is there any way to do this?

Thank you in advance.

Tags (2)
0 Karma

BobM
Builder

Yes. You need to move the eval to after the timechart.

|timechart distinct_count(Stuff)
|eval Time=strftime(_time, "%m/%d/%Y %H:%M:%S")

but this will leave you with both _time and Time and in my case Time was at the wrong end of the table so I added the following.

| fields - _time | table Time *

sflunk
Engager

Worked beautifully. Thank you!!!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...