Splunk Search

extract selected data from given field

x05311
Explorer

I've error messages in the filed name "ErrorMessage"; i want to extract only error code using regex expression.
Pls some one help with correct regex.

filed1 field2 filed3 and so on ... ErrorMessage
ANK-BEQ-1014 Dispatcher detected an error4.
ANK-BEQ-1015 Dispatcher detected an error5.
ANK-BEQ-1016 Dispatcher detected an error6.
Logon Error.
System Error.

Expected results Error codes:
ANK-BEQ-1014
ANK-BEQ-1015
ANK-BEQ-1016

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

Try this

yoursearchhere
| rex field=original_field_name "(?<error_code>.*?)\s"

View solution in original post

0 Karma

lguinn2
Legend

Try this

yoursearchhere
| rex field=original_field_name "(?<error_code>.*?)\s"
0 Karma
Get Updates on the Splunk Community!

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

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...