Splunk Search

Timechart with eval

cet
Engager

We are showing a timechart with bandwidth in kilobits per second. We would like to transform this data into kilobytes per second. So the value of bandwidth divided by 1024.

This is the query:

name="Bandwidth by Client"  (515502 OR 410407 OR 414565 OR 444422 OR 777777) | timechart median(measures.Bandwidth) by "dimensions.Client Name"

I tried various things, such as adding an eval before, and then piping it on to the timechart, and also adding an eval function around the median function. But nothing seems to work.

We are using Splunk 6.0.1

Thank you in advance
Gidon

Tags (2)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi cet,

assuming your kilobits field name is measures.Bandwidth you can do the following:

name="Bandwidth by Client" (515502 OR 410407 OR 414565 OR 444422 OR 777777) | eval measures.Bandwidth='measures.Bandwidth'/1024 | timechart median(measures.Bandwidth) by "dimensions.Client Name"

you can also rename the median in the timechart like this:

name="Bandwidth by Client" (515502 OR 410407 OR 414565 OR 444422 OR 777777) | eval measures.Bandwidth='measures.Bandwidth'/1024 | timechart median(measures.Bandwidth) AS median.KB.Bandwidth by "dimensions.Client Name"

watch out for the '' around the field name in eval, else eval will not ignore the dot in the name. Or rename your field to something without . in the name before the eval.

hope this helps ...

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi cet,

assuming your kilobits field name is measures.Bandwidth you can do the following:

name="Bandwidth by Client" (515502 OR 410407 OR 414565 OR 444422 OR 777777) | eval measures.Bandwidth='measures.Bandwidth'/1024 | timechart median(measures.Bandwidth) by "dimensions.Client Name"

you can also rename the median in the timechart like this:

name="Bandwidth by Client" (515502 OR 410407 OR 414565 OR 444422 OR 777777) | eval measures.Bandwidth='measures.Bandwidth'/1024 | timechart median(measures.Bandwidth) AS median.KB.Bandwidth by "dimensions.Client Name"

watch out for the '' around the field name in eval, else eval will not ignore the dot in the name. Or rename your field to something without . in the name before the eval.

hope this helps ...

cheers, MuS

MuS
SplunkTrust
SplunkTrust

you're welcome 🙂

0 Karma

cet
Engager

GREAT!!! Thanks a million!

0 Karma

MuS
SplunkTrust
SplunkTrust

facepalm stupid me, see my update to fix it 😉

0 Karma

cet
Engager

did you mean:

name="Bandwidth by Client" (515502 OR 410407 OR 414565 OR 444422 OR 777777)| eval measures.Bandwidth=measures.Bandwidth/1024

this does return events. I also checked that measurs.Bandwidth is a number, and yes splunk recognizes it as a number.

0 Karma

MuS
SplunkTrust
SplunkTrust

remove everything after the eval and see if you get anything

0 Karma

cet
Engager

Once I add the eval expression , my timechart stops working. The statistics tab shows 0 stats. What could be the problem?

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!

Fuel Your Journey: What’s Waiting for You at the .conf26 Acceleration Station

Navigating the show floor at .conf26 isn't just about keynotes and technical breakout sessions; it's also ...

Join the Final Session of the Data Management & Federation Bootcamp Series

Over the past three sessions of the Data Management & Federation Bootcamp Series, we've explored how to build ...

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...