Splunk Search

How to convert numeric values to decimal numbers?

iamsplunker
Communicator

I have a field called Availability and the field values are like 98.32 % and I want them to be converted as decimal numbers like "0.9832" please help

Labels (2)
Tags (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

An example event or two would be helpful, but perhaps this will get you started.

 

| eval Availability = round(tonumber(rtrim(Availability, "%")) / 100, 4)

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

An example event or two would be helpful, but perhaps this will get you started.

 

| eval Availability = round(tonumber(rtrim(Availability, "%")) / 100, 4)

 

---
If this reply helps you, Karma would be appreciated.

spitchika
Path Finder

Yes your answer perfectly works...
| makeresults
| eval value="98.32%"
| eval Availability = round(tonumber(rtrim(value, "%")) / 100, 4)

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...