Splunk Search

Help in query to count the total of the same coloumn ?

vrmandadi
Builder

Hello Experts,

How to calculate the count of the events based on the value of a particular field

example:

                                                                     ....  | stats count by  URL

           URL                                                  COUNT

        JSON_DB_1/%231                                  100
         JSONPayingBank/%231                         80
        /RTDC/RTDC/RTDC/RTDC%231             50

the data has all combination of the url,like some have
1) JSON_DB_1/%231 and JSONPayingBank/%231
2) JSON_DB_1/%231 and /RTDC/RTDC/RTDC/RTDC%231

3) ALL three
the JSON_DB_1/%231 is common for all,but i want to count of urls with JSON_DB_1/%231 and JSONPayingBank/%231 and name it as Paying bank..

Tags (3)
0 Karma

somesoni2
Revered Legend

Try something like this

your base search | eval URL=mvfilter(NOT match(URL,"JSON_DB_1")) | stats count by URL

This will eliminate the common URL value JSON_DB_1/%231 and will give count of events for other two URL values.

0 Karma

vrmandadi
Builder

I have tried your query and other possible match patterns but it throwing me the following error

Error in 'eval' command: The expression is malformed. Expected ).

0 Karma

somesoni2
Revered Legend

This should've worked. Can you post the query you tried?

0 Karma

somesoni2
Revered Legend

So you have field URL which is multivalued field for each event?

0 Karma

vrmandadi
Builder

Yes Somesoni

0 Karma

vrmandadi
Builder

each event has a combination of these urls and JSON_DB_1/%231 is common in all events

0 Karma
Get Updates on the Splunk Community!

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 ...

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 ...