Splunk Search

How to extract a number from a line of my sample data to a new field?

jaramirez
New Member

Hello

I have this line of data: "Found [40] settings to update" , I can search this with this regex:

regex Action="Found \[\d{1,3}\] settings to update"

I need to extract the number in a new field. Is there any way to do this?.

Thank you.

0 Karma
1 Solution

gfuente
Motivator

Hello

Just use this rex command in your search string:

... | rex "Found\s\[(?<yournewfield>[^\]]*)\]" | ...

Regards

View solution in original post

gfuente
Motivator

Hello

Just use this rex command in your search string:

... | rex "Found\s\[(?<yournewfield>[^\]]*)\]" | ...

Regards

jaramirez
New Member

Work

Thank you!!.

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 ...