Splunk Enterprise

Eval count event field

arbero
New Member

Hello Community

I'm new with splunk and I need your help.

I have for example the following output (events):

COL_A       COL_B       COL_ID
row1        row1        1
row2        row2        2
row3        row3        1
row4        row4        3
row5        row5        1
row6        row6        2

What I want, is to add a new field to count them by the occurrence of their ID (col_id):

COL_A       COL_B       COL_ID      occurred
row1        row1        1           3
row2        row2        2           2
row3        row3        1           3
row4        row4        3           1
row5        row5        1           3
row6        row6        2           2

Is there a way to do this?

Br,
Arber

Tags (1)
0 Karma

woodcock
Esteemed Legend

Like this:

| makeresults | eval raw="row1 row1 1::row2 row2 2::row3 row3 1::row4 row4 3::row5 row5 1::row6 row6 2"
| makemv delim="::" raw
| mvexpand raw
| fields - _time
| rex field=raw "^(?<COL_A>\S+)\s+(?<COL_B>\S+)\s+(?<COL_ID>\S+)$"

| rename COMMENT AS "Everything above fakes your data; everything below is your solution"

| eventstats count AS occurred BY COL_ID
0 Karma
Get Updates on the Splunk Community!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...