Splunk Search

extract errorcode

indeed_2000
Motivator

Hi

Here is th e log:

2021-10-26 08:17:19,117 WARN AbCD-App2-0000 [SqlExceptionHelper] SQL Error: -268, SQLState: 23000
2021-10-26 08:01:47,674 WARN CUS.AbCD-APP2-0000000 [SqlExceptionHelper] SQL Error: -100, SQLState: IX000

 

expected output:

Error    Status

268     23000

100      IX000

 

Thanks

Labels (5)
0 Karma
1 Solution

indeed_2000
Motivator

after several try, find correct rex:

| rex "SQL\sError\:\s\-(?<Error>\d+)" | rex "\:\s(?<Status>\w+)"

 

View solution in original post

0 Karma

indeed_2000
Motivator

after several try, find correct rex:

| rex "SQL\sError\:\s\-(?<Error>\d+)" | rex "\:\s(?<Status>\w+)"

 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Rex should work:

<base search>
| rex "SQL Error: -(?<Error>]\d+), SQLState: (?<Status>.+)"
| table Error Status

 

0 Karma

indeed_2000
Motivator

not work

Tags (1)
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 ...