Splunk Search

Need help with totals in subsearch

Akita881
New Member

I have a search and subsearch. The search looks for an IP addresses occurring more than 50 times and returns the count.

SEARCH: | stats dc(User) as UserCount, count by SourceIP | where count > 50

Then the subsearch appends its results under the listed SourceIPs.

| appendcols [search | rex ".USER_ID=(?<DynamicUser>(.?));" | stats , values(DynamicUser) as DynUser, count by clientip | where count > 50 ]

The results are:

clientip.......................count...........DynamicUser
63.73.199.69...............107.................10512
...........................................................12768
...........................................................138934
...........................................................27102
...........................................................3195242
...........................................................3203
...........................................................32160
...........................................................334304

What I want to include is an individual count of each DynamicUser, which would total 107 in the example. Any help would be appreciated.

Tags (2)
0 Karma
1 Solution

woodcock
Esteemed Legend

If I am understanding you, this should do it:

[ ...| stats dc(User) as UserCount, count by SourceIP AS clientip | where count > 50 | field clientip ] | rex ".USER_ID=(?<DynamicUser>(.?));" | stats count by clientip DynamicUser ]

View solution in original post

0 Karma

woodcock
Esteemed Legend

If I am understanding you, this should do it:

[ ...| stats dc(User) as UserCount, count by SourceIP AS clientip | where count > 50 | field clientip ] | rex ".USER_ID=(?<DynamicUser>(.?));" | stats count by clientip DynamicUser ]
0 Karma

Akita881
New Member

Thank you for the help

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

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