Dashboards & Visualizations

RESOLVED - Create a chart from a converted number

marco_carolo
Path Finder

Hello there 😉

 

So, what I'm trying to do is the following.

I have inside the log all the slow queries.

I'm trying to create a chart to get from the timing of the slow queries, grouped by 10.

One bar counting the queries from 0 to 10 sec

the other from 10 to 20 and so on...

 

What I've done so far was that:

index="SUG" "slow query" | rex field=_raw "Slow Query (time: (?<OSY_timing>.*)s):" | eval OSY_new=round(tonumber(OSY_timing),-1) | stats count by OSY_new

 

Unfortunately, I'm not able to see any results inside OSY_new, where I should expect the values rounded by 10 (if I read the documentation correctly).

Any hint on how to do that?

 

Thanks.

 

P.s. I've the correct values inside OSY_timing

Labels (1)
0 Karma
1 Solution

marco_carolo
Path Finder

Tested and verified. The problem was the missing trim...

View solution in original post

0 Karma

marco_carolo
Path Finder

Resolved. The problem was in the name of the evaluated variable. Changed to something else solved the problem!

 

This works!

 

index="SUG" "slow query" | rex field=_raw "Slow Query (time: (?<OSY_timing>.*)s):" | eval VALORE = round(tonumber(trim(OSY_timing)),-1) | stats count by VALORE | sort VALORE

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The name shouldn't have mattered, it looks more like the trim inside the tonumber was effective.

0 Karma

marco_carolo
Path Finder

Tested and verified. The problem was the missing trim...

0 Karma

marco_carolo
Path Finder

Yep, true, tried with the underscore value inside the name and it works... Dunno what happened here...

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...