Splunk Search

Trying to extract field in log file, can you please help with regex and field extraction.

PavanSeerapu
Explorer

Caused by: java.sql.SQLException: Io exception: Socket closed

i want to extract "java.sql.SQLException"

 

Can you please do the needful.

Labels (1)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @PavanSeerapu,

You can use below rex command;

 

| rex "[^:]+:\s+(?<exception>[^:]+)"

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @PavanSeerapu,

This regex does not work, because there is a problem with double-quotes and there is no numeric value. Please try below;

| rex "java.sql.SQLException:\s+(?<SQLexception>.*)"
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

PavanSeerapu
Explorer

| rex field=_raw "Caused by"\:\s+(?P<SQLexception>\d+)

 

I tried this but didn't work

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @PavanSeerapu,

You can use below rex command;

 

| rex "[^:]+:\s+(?<exception>[^:]+)"

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma
Get Updates on the Splunk Community!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...