Splunk Search

rex for source target

indeed_2000
Motivator

Hi

here is my log:

2020-01-19 13:20:15,093 INFO ABC.InEE-Product-00000 [MyProcessor] Detail Packet: M[000] T[111] P[0A0000] AT[00] R[0000] TA[ABC.OutEE-Product] Status[OUT-LOGOUT,EXIT]

2020-01-19 13:36:08,185 INFO ABC.InEP-Product-00000 [MyProcessor] Detail Packet Lost: M[000] T[111] SA[ABC.InEE-Product]  R[0000]

 

what is the rex for

SOURCE=ABC.InEE-Product

TARGET=ABC.OutEE-Product

Model=000

Tip=111

POD=0A0000

 

any idea?

Thanks,

Labels (2)
Tags (2)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust

Hi @indeed_2000 

You need two different rex as second event is little bit different from first you don't have every field there, see if you can merge them together.

 

| rex "\d+:\d+:\d+\,\d+\s+\w+\s+(?<SOURCE>\S+).+M\[(?<MODEL>[^\]]+)\]\s+T\[(?<TIP>[^\]]+)\]\s+P\[(?<POD>[^\]]+).+?TA\[(?<TARGET>[^\]]+)\]" 
| rex "\d+:\d+:\d+\,\d+\s+\w+\s+(?<SOURCE>\S+).+M\[(?<MODEL>[^\]]+)\]\s+T\[(?<TIP>[^\]]+)\]\s+SA\[(?<SOURCE>[^\]]+)"

 

 POD , TARGET missing in your second event.

---

An upvote would be appreciated and Accept solution if this reply helps! 

View solution in original post

venkatasri
SplunkTrust
SplunkTrust

Hi @indeed_2000 

You need two different rex as second event is little bit different from first you don't have every field there, see if you can merge them together.

 

| rex "\d+:\d+:\d+\,\d+\s+\w+\s+(?<SOURCE>\S+).+M\[(?<MODEL>[^\]]+)\]\s+T\[(?<TIP>[^\]]+)\]\s+P\[(?<POD>[^\]]+).+?TA\[(?<TARGET>[^\]]+)\]" 
| rex "\d+:\d+:\d+\,\d+\s+\w+\s+(?<SOURCE>\S+).+M\[(?<MODEL>[^\]]+)\]\s+T\[(?<TIP>[^\]]+)\]\s+SA\[(?<SOURCE>[^\]]+)"

 

 POD , TARGET missing in your second event.

---

An upvote would be appreciated and Accept solution if this reply helps! 

codebuilder
Influencer

Have you tried using erex to build the regex for you? It's very handy.

https://docs.splunk.com/Documentation/Splunk/8.2.1/SearchReference/Erex

----
An upvote would be appreciated and Accept Solution if it helps!
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...