Splunk Search

Search Question: Event Sampling

adalbor
Builder

Does anyone know of a good way to pull one event of a specific eventcode/type when searching for multiple eventcodes?

It doesn't appear that event sampling can do something like that.

I was hoping to run a search for all Windows EventCodes and to only return one event of each type.

Is that possible?

Thanks,
Andrew

0 Karma
1 Solution

niketn
Legend

@adalbor for the community to assist you better can you please add more details? What are the fields you have/are interested in and what is does your current SPL/data looks like?

Can you try one of the following?

<yourSearchToPullData>
| dedup EventCode
| table EventCode *

Or with stats

<yourSearchToPullData>
| stats latest(*) as * by EventCode
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

niketn
Legend

@adalbor for the community to assist you better can you please add more details? What are the fields you have/are interested in and what is does your current SPL/data looks like?

Can you try one of the following?

<yourSearchToPullData>
| dedup EventCode
| table EventCode *

Or with stats

<yourSearchToPullData>
| stats latest(*) as * by EventCode
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

adalbor
Builder

That was too easy! Thank you!
I used
index=wineventlog
| dedup EventCode
| table EventCode,Message

0 Karma

niketn
Legend

@adalbor I have converted my comment to answer. Please accept to mark this question as answered. Also, if you have used dedup also add fields before dedup to retain only the fields you are interested in.

 index=wineventlog
 | fields EventCode Message
 | dedup EventCode
 | table EventCode Message
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...