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
Get Updates on the Splunk Community!

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

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 ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...