Splunk Search

How to make a query that counts by comparing values?

hyewonkim
Engager
I'm new to splunk and I'm asking for help. 
I will give an example as below. if event_id or orig_event are the same, count them I want to lookup event_id for case not 3.
Therefore, in this case, the count of event_id 7 is 2, not 3, so 7 should be the lookup.
could you possibly help me?

[data table]

index type event_id orig_event_id
A a 1  
A b   1
B c   1
A a 3  
A b   3
B c 3  
A a   5
A b 5  
B c   5
A a   7
A b 7  

 

[result]

A a   7
A b 7  

 

Labels (4)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Not sure if this is what you are after as your description does quite tally with your example

| stats count(eval(event_id == orig_event_id)) as count by index type
0 Karma

hyewonkim
Engager
There were some mistakes in the content. It has only one value among orig_event_id and event_id.
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Are you just after the last event_id and orig_event_id by index and type?

| stats last(event_id) as event_id last(orig_event_id) as orig_event_id by index type
0 Karma
Get Updates on the Splunk Community!

The Payment Operations Wake-Up Call: Why Financial Institutions Can't Afford ...

The same scenario plays out across financial institutions daily. A payment system fails at 11:30 AM on a busy ...

Make Your Case: A Ready-to-Send Letter for Getting Approval to Attend .conf25

Hello Splunkers, Want to attend .conf25 in Boston this year but not sure how to convince your manager? We've ...

Community Spotlight: A Splunk Expert's Journey

In the world of data analytics, some journeys leave a lasting impact not only on the individual but on the ...