Splunk Search

Rex command issue in splunk views

iamniks
Explorer

Hi,

i am using the below search command in a splunk view as given below.

index=re sourcetype="clearcase_Log" "Trouble opening VOB database" earliest=-7d |rex field=_raw ".vbstore/(?.).vbs" |
stats count as "ERROR INSTANCES" by vob

is causing trouble as we have to place search query inside tags. I tried to use < and > for < and > respectively which failed too. Can you please help me with the below error?

***Error in 'rex' command: Encountered the following error while compiling the regex '.*vbstore/(?
.
).vbs': Regex: unrecognized character after (? or (?-
****

Tags (1)
0 Karma

Ayn
Legend

When you're enclosing the tags that are causing you trouble in an XML document, they are interpreted as part of the XML data rather than as part of the rex command. To specify that these tags are not referring to the XML structure, use the special escaping sequence "<![CDATA[" at the beginning of your string and its corresponding end sequence "]]>" at the end. Example here: http://splunk-base.splunk.com/answers/30157/inputlookup-in-view-with-rex

Ayn
Legend

Awesome. Could you please mark my answer as accepted? Thanks!

0 Karma

iamniks
Explorer

This works now.. grt thank you . I had left an extra special char.

0 Karma

Ayn
Legend

Also your extraction probably doesn't extract what you want. You likely want .vbstore/(?<vob>.+?)\.vbs

0 Karma

Ayn
Legend

Are you using a space after the ( character? You shouldn't, it's incorrect syntax and would cause Splunk to throw that error.

0 Karma

iamniks
Explorer

doesnt work for CDATA also

0 Karma

iamniks
Explorer

Error in 'rex' command: Encountered the following error while compiling the regex '.vbstore/(? .).vbs': Regex: unrecognized character after (? or (?-**

0 Karma

iamniks
Explorer

i mean i tried to use (without spaces)
"& l t ;" for < and "& g t ;" for > but failed

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...