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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...