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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...