Splunk Search

Can you remove a unit of measurement from a field value?

mbond81
Engager

I'm trying to calculate man hours, but my field format is "12 Mins" not simply "12". How can I either calculate this numeric value with the unit attached, or remove the unit "Mins" and calculate the total that way?

Tags (3)
0 Karma

sansay
Contributor

The simplest flexible way:
... | convert rmunit(FieldName) | ...

mattymo
Splunk Employee
Splunk Employee

beauty command, that I didn't even know existed! thanks!

- MattyMo
0 Karma

woodcock
Esteemed Legend

Remove it like this:

... | rex field=MyField mode=sed "s/\s+Mins$//"
0 Karma

ehudb
Contributor

Lets assume your field is named "time", you can extract it with rex:

|rex field=time "(?\d+)" |stats sum(mins) as total

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Index This | How many sevens are there between 1 and 100?

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

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...