Splunk Search

How to search the event log based on a parameter value from another search from the same event log?

vijayaxyz
New Member

We would like to have the search results based on the following criteria. We have records in the event log with the following values

transactionID: abc | is_true: 1 | eventType: main | other_attributes_data

transactionID: abc | eventType: event-A | other_attributes_data

transactionID: abc | eventType: event-C | other_attributes_data

transactionID: abc | eventType: event-F | other_attributes_data

transactionID: def | is_true: 0 | eventType: main | other_attributes_data

transactionID: def | eventType: event-B | other_attributes_data

transactionID: def | eventType: event-C | other_attributes_data

transactionID: def | eventType: event-E | other_attributes_data

We basically want a search string, that identifies the "main" event records whose is_true value is "1". Once that is done, then we want all the events that are associated to the same "transactionID". 

In this example, since "transactionID: abc" has the main event, whose is_true value is 1, then we would like to list all the events associated to that particular transactionID. 

The output for the query ranswer for the query will be something like

transactionID: abc | eventType: main | other_attributes_data

transactionID: abc | eventType: event-A | other_attributes_data

transactionID: abc | eventType: event-C | other_attributes_data

transactionID: abc | eventType: event-F | other_attributes_data

 

The "transactionID: def" records will not be coming back in the search results, as the corresponding main event has is_true value of "0".

How can we write such query?

Appreciate the response. Thanks,

 

 

 

Labels (1)
Tags (1)
0 Karma

vijayaxyz
New Member

Thanks. That worked.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you have extracted the isTrue and transactionID fields

| eventstats values(isTrue) as isTrue by transactionID
| where isTrue==1
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...