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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...