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!

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