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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...