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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...