Splunk Search

rex for extract codes

indeed_2000
Motivator

hi
what is the rex for extract all brackets contain this pattern
[AB_123] [ZXY_987]

1-check all brackets if start with AB_ extract this AB_123
2-check all brackets if start with ZXY_ extract this ZXY_987
3-put all this in single field that call "Codes"

any idea?
thanks

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\[(?<Codes>(AB|ZXY)[^\]]+)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\[(?<Codes>(AB|ZXY)[^\]]+)"
Get Updates on the Splunk Community!

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!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...