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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...