Splunk Search

How to convert a number to String?

gokikrishnan
New Member

Can somebody please help me in converting a number back to string?

Tags (1)
0 Karma

renjith_nair
Legend

@gokikrishnan,

eval num_field = tostring(num_field)

Reference : tostring

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

gokikrishnan
New Member

I did the following
eval num_field = tostring(num_field)|stats num_field by Field.
It was working till tostring conversion. Throwing error if I use the stats command. The error as follows
Error in 'stats' command: The argument 'Field' is invalid.

0 Karma

renjith_nair
Legend

for using stats you need an aggregate function like , sum,max,min etc

If you could tell us your exact requirement, that might help

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

niketn
Legend

@gokikrishnan as stated by @renjith.nair the issue seems to be with your stats command rather than string conversion. Seems like you will not need string conversion in the first place. For the community to assist you better with your query it would be nice if you provide what is the kind of data you have and what is the output you need. You should check out Statistical aggregating functions to understand them better: https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonStatsFunctions#Supported_f...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...