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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...