Splunk Search

Hello, I need help to extract a value from a string

flck
Path Finder

Hi everyone,


I hope someone can help me with the following situation.
I have multiple events generated from Azure Devops like the following:

{"system.pullRequest.pullRequestId":"223033","system.pullRequest.sourceBranch":"refs/heads/release","system.pullRequest.targetBranch":"refs/heads/master","system.pullRequest.sourceCommitId":"e000000a962ff66c19aacXXXXXXX4c7","system.pullRequest.sourceRepositoryUri":"https://siteXXX.visualstudio.com/XXXX%XXX%20ds%XXXX%C3%ADa/_git/AWXXX000","system.pullRequest.pullRe..."}

 

I am trying to extract the value that corresponds to the field "system.pullRequest.pullRequestId", for this example it is "223033", I have not been able to achieve it yet. Any idea how to do it?

For some events the field "system.pullRequest.pullRequestId" is not at the beginning of the string, it can be in the middle or at the end, the position varies with each event.

I appreciate any help you can give me.

Labels (3)
1 Solution

flck
Path Finder

Hi,


Thanks for your answer, I tested the rex and it only counts but it does not extract the field I need. Trying a little more I was able to extract it like this:

... | eval _raw = parameters | extract

View solution in original post

0 Karma

inventsekar
SplunkTrust
SplunkTrust

Hi @flck ..

may we know what output you get with this above rex query. 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "system\.pullRequest\.pullRequestId\":\"(?<pullrequestid>\d+)\""

flck
Path Finder

Hi,


Thanks for your answer, I tested the rex and it only counts but it does not extract the field I need. Trying a little more I was able to extract it like this:

... | eval _raw = parameters | extract

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...