Splunk Search

How can I convert a text string to a number?

ptur
Path Finder

I have a field that contains a text string representing time ("900 ms" for example - all values are in milliseconds) is there a way to extract a number, so i can find values "greater than" or "smaller than"?

0 Karma
1 Solution

493669
Super Champion

try this

...|rex field=<fieldname> "(?<ms>\d+)"

include your fieldname here

View solution in original post

0 Karma

TISKAR
Builder

Hello,

Can you try this please:

|makeresults | eval field="900 ms" | rex field=field "(?<field>\d+)"

Regards

0 Karma

493669
Super Champion

try this

...|rex field=<fieldname> "(?<ms>\d+)"

include your fieldname here

0 Karma

ptur
Path Finder

thanks !!!

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

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