Splunk Search

Can you help me to extract a specific event from a log?

jip31
Motivator

Hello

In a report, i used the code below in order to search for an error code in my events.

But, when a code is found, i want to display the complete line event and not only the code error.

index=main sourcetype="applog"  | rex "Failed Error code : (?<ErrorCode>.*)" |table host ErrorCode

Thanks in advance for your help.

Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Depending on what exactly you're trying to do, there's a few ways to do it.

index=main sourcetype="applog" "Failed Error code : "

index=main sourcetype="applog"  | regex "Failed Error code :"

index=main sourcetype="applog"  | rex "Failed Error code : (?<ErrorCode>.*)" | table host ErrorCode _raw
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

@jip31

Did the answer below solve your problem? If so, please resolve this post by approving it!
If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Depending on what exactly you're trying to do, there's a few ways to do it.

index=main sourcetype="applog" "Failed Error code : "

index=main sourcetype="applog"  | regex "Failed Error code :"

index=main sourcetype="applog"  | rex "Failed Error code : (?<ErrorCode>.*)" | table host ErrorCode _raw
---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...