Splunk Search

How to extract below field from logs ?

Dinesh_Raja
Path Finder

Hello,

I need to create a dashboard which shows error messages & its count over the time. i have a logfile like below and i would like to extract the error message as a field.

"[syncservice] [ERROR] [20 Mar 2018 04:09:56,654] : [7dfhsdgw-4dgsj-ashgah-svahs5226] : [com.xxx.xxxx.xxxx.xxxx]: Failed to invoke service xxx.xxxxxx.xxxx.ConnectorException: IOException occurred for ServiceLogMessage while obtaining response: Connection to http://localhost:8080 refused"

0 Karma
1 Solution

cmerriman
Super Champion

based on @tiagofbmm 's answer, try this | rex field=_raw "ConnectorException:\s(?<ConnectorException>.*)"

you can test out regex's at this website: https://regex101.com/
it is a great place to learn and test out what you're doing.

View solution in original post

0 Karma

cmerriman
Super Champion

based on @tiagofbmm 's answer, try this | rex field=_raw "ConnectorException:\s(?<ConnectorException>.*)"

you can test out regex's at this website: https://regex101.com/
it is a great place to learn and test out what you're doing.

0 Karma

Dinesh_Raja
Path Finder

Hello @cmerriman,
Yes, it works & Thanks for sharing the knowledge 🙂

0 Karma

tiagofbmm
Influencer

Working solely on the example you gave in the question,

| rex field=_raw "ConnectorException:s(?.*)"

0 Karma

Dinesh_Raja
Path Finder

Hello @tiagofbmm,
Thanks for the answer.
But, i m getting error as "Error in 'rex' command: Encountered the following error while compiling the regex 'ConnectorException:s(?.*)': Regex: unrecognized character after (? or (?- "

0 Karma

tiagofbmm
Influencer

My bad, forgot to put it as Code

| rex field=_raw "ConnectorException\:s(?<ConnectorException>.*)"

tiagofbmm
Influencer

Please upvote and accept answers

0 Karma

493669
Super Champion
...| rex field=_raw "ConnectorException\:s(?<errormsg>.*)"

Dinesh_Raja
Path Finder

Thanks for your answer @493669.
:)

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...