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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...