Splunk Search

Reverse time info in chart

Ste
Path Finder

Dear experts

My search

index="abc" search_name="xyz" Umgebung="prod" earliest=-7d@d latest=@d zbpIdentifier IN (454-594, 256-14455, 453-12232)
| bin span=1d _time aligntime=@d
| stats count as myCount by _time, zbpIdentifier
| eval _time=strftime(_time,"%Y %m %d") 
| chart values(myCount) over zbpIdentifier by _time limit=0 useother=f

produces the following chart:

 

Ste_0-1733926591588.png

For each zbpIdentifier I have a group within the graph showing the number of messages during several days. 

How to change the order of the day values within the group? Green (yesterday) should be the most left, followed by pink (the day before yesterday) and orange, .....

| reverse

will change the order of the whole groups, that's not what I need. 

All kind of time sorting like 

| sort +"_time"
or
| sort -"_time"

before and after 

| chart ...

 does not change anything.

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Chart will put the columns in ascending order lexicographically. To get around this, you should use transpose, sort and transpose (back). Try something like this

| bin span=1d _time aligntime=@d
| stats count as myCount by _time, zbpIdentifier
| chart values(myCount) over zbpIdentifier by _time limit=0 useother=f
| transpose 0 column_name=date header_field=zbpIdentifier
| sort 0 -date
| eval date=strftime(date, "%Y %m %d")
| transpose 0 column_name==zbpIdentifier header_field=date

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Chart will put the columns in ascending order lexicographically. To get around this, you should use transpose, sort and transpose (back). Try something like this

| bin span=1d _time aligntime=@d
| stats count as myCount by _time, zbpIdentifier
| chart values(myCount) over zbpIdentifier by _time limit=0 useother=f
| transpose 0 column_name=date header_field=zbpIdentifier
| sort 0 -date
| eval date=strftime(date, "%Y %m %d")
| transpose 0 column_name==zbpIdentifier header_field=date

Ste
Path Finder

@ITWhisperer Cool, your proposal does exactly what I was looking for.
Thank you. 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...