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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...