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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...