Splunk Search

Convert num not working

venanciop
New Member

Convert does not work

search | convert num(quantity) as Quantity

The quantity field samples are: 1.0000
2.0000
9.0000
7.0000

0 Karma

tzitello_splunk
Splunk Employee
Splunk Employee

When I run convert on a field name, it does not convert the new field to numeric, it's alpha numeric. I'm running V 7.2.1

search| convert num(Samples.Sample.Depth) as meters

meters shows up with a instead of #. Suggestions?

0 Karma

koshyk
Super Champion

When you say it is NOT working, i'm not sure I understand. You provided quantity already as a number, so you won't see the difference

Try below to see the difference. You can see rounding works , sum works etc.

|makeresults | eval quantity="1.0000" | convert num(quantity) as Quantity| eval Quantity=round(Quantity,2)| eval sumQuantity=(1 + Quantity)
0 Karma

DalJeanis
SplunkTrust
SplunkTrust

Change that to | eval quantity="1.0000 " (non numeric) if you want to demonstrate any difference.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...