All Apps and Add-ons

Timewrap: How to reverse results to show oldest to newest from left to right, not right to left?

HattrickNZ
Motivator

Timewrap is reading oldest to newest from right to left. I want it to be the opposite newest to oldest from left to right.

The pic below shows that may 7th is the oldest but it is showing on the right and aug 13(yesterday) on the left.

<a href="http://tinypic.com?ref=11vk4mr" target="_blank"><img src="http://i58.tinypic.com/11vk4mr.jpg" border="0" alt="Image and video hosting by TinyPic"></a>

In case the pic is not showing above here it is again: alt text

this gives an idea of my search:

index=core ... earliest=-100d@d latest=+d@d | timechart span=d sum(c140509343) as "Incoming downlink user traffic in KB (SGSN/SGW PLMN)"  | eval wday = strftime(_time, "%a") | where wday = "Thu" |  fields - wday | timewrap d series=exact

Is there a way I can somehow reverse this?

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

If you're OK to change the format of date that being displayed on the series from aug07 to 08-07, this should do the trick.

index=core ... earliest=-100d@d latest=+d@d | timechart span=d sum(c140509343) as "Incoming downlink user traffic in KB (SGSN/SGW PLMN)"  | eval wday = strftime(_time, "%a") | where wday = "Thu" |  fields - wday | timewrap d series=exact | untable _time series value | eval series=mvindex(split(series,"_"),0)."_".strftime(strptime(mvindex(split(series,"_"),1),"%b%d"),"%m-%d") | chart values(value) over _time by series

View solution in original post

somesoni2
Revered Legend

If you're OK to change the format of date that being displayed on the series from aug07 to 08-07, this should do the trick.

index=core ... earliest=-100d@d latest=+d@d | timechart span=d sum(c140509343) as "Incoming downlink user traffic in KB (SGSN/SGW PLMN)"  | eval wday = strftime(_time, "%a") | where wday = "Thu" |  fields - wday | timewrap d series=exact | untable _time series value | eval series=mvindex(split(series,"_"),0)."_".strftime(strptime(mvindex(split(series,"_"),1),"%b%d"),"%m-%d") | chart values(value) over _time by series

martin_mueller
SplunkTrust
SplunkTrust

You can include the year to be less American and more ISO 8601: 2015-08-07
As another upside, this will maintain ordering in a few months when we roll over back to January.

0 Karma

HattrickNZ
Motivator

that works tks. although I am not a big fan of the american date format MM-dd 🙂
Also it does some grouping but I can use limit=0 as a paramter to chart to get around this. tvm

Get Updates on the Splunk Community!

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

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...