Splunk Search

How to rex extract two last word?

indeed_2000
Motivator

Hi how can I extract only last 2 word that exist in className

I have log like this:

2022-05-24 16:29:51,918 INFO [APP] [ActionName] className[xx.xx.xxx.xxxx.xxx.session.controller.SearchClusterFinancialTcpMBean.search] status[done]

2022-05-24 16:29:51,918 INFO [APP] [ActionName] className[xx.xx.xxx.xxxx.xxx.session.controller.SearchClusterFinancialTcpMBean.search.attribute] status[done]

 

excpected output:

SearchClusterFinancialTcpMBean.search

search.attribute

 

Any idea?

Thanks,

Labels (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This regular expression should do it.

className\[.*?(?<lastTwo>[^\.]+\.[^\.]+?)]
---
If this reply helps you, Karma would be appreciated.

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex "className.*\.(?<class>\w+\.\w+)\]"
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This regular expression should do it.

className\[.*?(?<lastTwo>[^\.]+\.[^\.]+?)]
---
If this reply helps you, Karma would be appreciated.
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 ...