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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...