Splunk Search

Help with regular expression

indianhans
Engager

I wish to extract any number between "cmdbRequest" & "- Transaction" . For Example from below string

ERROR 21 CMDB cmdbRequest 1089798797 - Transaction Null: 10/21/2015 07:25:34 - Exception: ORA-12578: TNS:wallet open failed

i wish to extract 1089798797

i have wrtten below regular expression to get the number, but its giving me a null value.

| rex "CMDBRequest(?P<Request_ID>.*?)Transaction" |

Can anyone please help ?

0 Karma

bevant
Explorer

won't you need to cater for the stuff either side (spaces/dashes?

rex "cmdbRequest\s(?<Request_ID>\d+)\s\-\sTransaction"

...or something like that, depending on how consistent you expect it to all be. I've not tested it, but it might put you on the correct path

0 Karma

abhijitmishra87
Explorer

Please try the following :

| rex "cmdbRequest(?P<Request_ID>\d+)Transaction" |
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...