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

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...