Dashboards & Visualizations

Can Splunk handle long digit number without rounding?

takaakinakajima
Path Finder

In v7.1.2, a SPL

| makeresults count=1 | eval num="1234567890123456789012345678901234567890"

returns 1234567890123456789012345678901234567890 as string. However,

| makeresults count=1
| eval num1="1234567890123456789012345678901234567890", num2=1
| eval total=num1+num2

returns rounded 'total' value 1234567890123456800000000000000000000000.
(We want true result 1234567890123456789012345678901234567891.)

Can we treat long digit decimal number correctly in SPL?

Tags (1)

takaakinakajima
Path Finder

@kamlesh_vaghela

It's a nice idea using custom app to enable treat long digit decimals like as BigDecimal in Java.
It is same as other computer language, implementation of real numbers in Splunk's has limitation.

@woodcock
I think the limitation is not problem essentially.
However it may become potential of unexpected behaviors for non-technical user.

0 Karma

woodcock
Esteemed Legend

You are cheating and complicating the actual problem by putting double-quotes around the value of num. There is a problem regardless. Open a support ticket but do not expect that anything will be done to make it work.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@takaakinakajima

It's hard to have it in SLP but you can try it by creating a custom command by writing basic mathematical operations. I have tried it with python. Maybe it will help you. Below are basic workaround what I did with python.

>>> a=123456789123456789123456789123456789123456789123456789123456789123456789123456789
>>> b=123456789123456789123456789123456789123456789123456789123456789123456789123456790
>>> c=a+b
>>> c
246913578246913578246913578246913578246913578246913578246913578246913578246913579L

Happy Splunking

Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...