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!

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