Splunk Search

How to use regex to extract field?

shugup2923
Path Finder

I have a field "dimension" with values:

dimension=InstanceIdentifier=[aaamcehjcdbp01]
dimension=InstanceIdentifier=[aaamcehgcdbp01]......and many more,

I want aaamcehjcdbp01 from this field as new field.

host=aaamcehjcdbp01 
host=aaamcehgcdbp01

Please help me with the regex or any other method.

0 Karma
1 Solution

493669
Super Champion

Try below regex-

|rex field=dimension "InstanceIdentifier=\[(?<Name>[^\]]+)"

Below is anywhere run search-

| makeresults |eval dimension="InstanceIdentifier=[aaamcehjcdbp01]"|rex field=dimension "InstanceIdentifier=\[(?<Name>[^\]]+)"

View solution in original post

0 Karma

493669
Super Champion

Try below regex-

|rex field=dimension "InstanceIdentifier=\[(?<Name>[^\]]+)"

Below is anywhere run search-

| makeresults |eval dimension="InstanceIdentifier=[aaamcehjcdbp01]"|rex field=dimension "InstanceIdentifier=\[(?<Name>[^\]]+)"
0 Karma

shugup2923
Path Finder

Thanks, it worked

0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...