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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...