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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...