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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...