Splunk Search

chart time based

surekhasplunk
Communicator

alt text

Hi ,

I want a chart exactly like the image attached.

My data is input lookup csv file .
My time filed name is "Opened"
Data Global * field name is "Assignment group"

Please help me with the query.

I tried something like this but this is not what i want.
index=level3 host=Test | chart count over Opened by "Assignment group"

Thanks

Tags (2)
1 Solution

JDukeSplunk
Builder

My first stab at it would be something like this. This will give you 14 days, including yesterday, but not today.

index=level3 host=Test earliest="-14d@d" latest="-0d@d" | timechart span=1d limit=20 count Opened by "Assignment group"

Then in the visualations tab change the format to Column, and Format, stacked.

alt text

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

Are the values in the "Opened" field epochtime values? ie integer numbers of seconds since 1/1/1970, or are they string formatted times. If the latter can you give an example value? Long story short you need to rename the time field to be "_time" and then convert it to epochtime format if it's not already. Then timechart will happily work with it just as though the rows were coming from regular indexed events.

0 Karma

JDukeSplunk
Builder

My first stab at it would be something like this. This will give you 14 days, including yesterday, but not today.

index=level3 host=Test earliest="-14d@d" latest="-0d@d" | timechart span=1d limit=20 count Opened by "Assignment group"

Then in the visualations tab change the format to Column, and Format, stacked.

alt text

0 Karma

surekhasplunk
Communicator

Now am getting results with the below query but am unable to sort it date wise rather it sorts numerically.
I have two date fields with values like this:

Opened = 09/27
Opened D = 09/29/16

Figure1

index=level3 host=Test | eval _time=strptime("Opened D","%Y-%m-%d %H:%M:%S.%N")|chart count OVER "Opened D" BY "Assignment group" | sort -"Opened D"

Figure2alt text

One more thing in the x-axis instead of “Opened D” how can I get the actual dates ?
If I enable event sampling only then am getting the dates if I slect “No event sampling” then the dates aren’t reflecting. How to solve this ?
And if I am enabling event sampling am missing some dates data also.

0 Karma

JDukeSplunk
Builder

I think you're going to have to use timechart instead of chart.

http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Timechart

Maybe..

...|timechart span=1d count(Opened) by "Assignment group"

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...