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!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...