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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...