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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...