Splunk Search

How do I construct a regular expression with wildcard matching?

dbcase
Motivator

Hi,

I have data that looks like this

####<Sep 15, 2016 9:35:27 AM CDT> <Debug> <ucontrol> <betamax-cpe1> <managedServer1> <client-8> <<anonymous>> <> <> <1473950127749> <BEA-000000> <org.jivesoftware.util.Log  - SENT: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>> 

####<Sep 15, 2016 10:18:53 AM CDT> <Warning> <ucontrol> <betamax-cpe1> <managedServer1> <smsQueueListenerContainer-1> <<anonymous>> <BEA1-35C7B98CDE9F> <> <1473952733478> <BEA-000000> <fn.service.impl.NumerexSmsSender  - UCE-22233 - Failed to send Numerex sms message to 5555555555> 

####<Sep 15, 2016 10:11:46 AM CDT> <Warning> <ucontrol> <betamax-portal1> <managedServer3> <[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1473952306182> <BEA-000000> <fn.webapp.listener.AuthenticationListener  - Authentication Auditing Failed: AuthenticationFailureBadCredentialsEvent> 

What I need to do is search on a failure but the failure condition is presented in several ways (i.e. failed: OR failed; OR failed, OR failed. OR <failure

What I need to do is match on failed* OR <failure and then capture to the end of the line.

Still rather new to regex so I'm unsure how to do wildcard matching

0 Karma
1 Solution

sundareshr
Legend

Try this

... | rex "\b(?<failmsg>[Ff]ail.*)"

View solution in original post

aaraneta_splunk
Splunk Employee
Splunk Employee

Hi @dbcase - Just so you know, I edited your original question to include your revised/correct last sentence instead of having it as a floating comment 🙂

0 Karma

sundareshr
Legend

Try this

... | rex "\b(?<failmsg>[Ff]ail.*)"

dbcase
Motivator

I have no idea how you do regex so eloquently.... Maybe one day I can do the same.... 🙂

0 Karma

twinspop
Influencer
... | rex "<?[fF]ail[eu][dr]?e?[:;,. ](?<failure_code>.*)"
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Something like this, perhaps?

... | rex "fail\w*\s*(?<failureMsg>.*)" | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

inventsekar
SplunkTrust
SplunkTrust

Please check this -

sourcetype=failure | rex field=_raw "<?[fF]ail[eu][dr]?e?[:;,. ](?<failedCode>.*)" | table failedCode _time _raw
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 ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...