Splunk Search

nawazns5038
Builder

Please try the following,

| eval new=case(like(_raw,"%/acc/basic"),"basic",like(_raw,"%/acc/view"),"view") | stats count by new

Results

new count
basic   4
view    3
0 Karma

nawazns5038
Builder

Works as well

| eval new=case(match(_raw,".*?basic"),"basic",match(_raw,".*?view"),"view") | stats count by new

Results

new count
basic   4
view    3
0 Karma

horsefez
Motivator

Hi @codebased,

I'm not really sure what the problem is, as you are not going to achieve a count with your regex command.

Let me suggest a possible solution:

yoursearch | rex mode=sed field=url "s/^([^\/]+\/\/[^\/]+\/[^\/]+\/[^\/]+\/[^\/]+\/)\d+(\/.+)/\1*\2/g"| stats count by url

https://regex101.com/r/Ts3HpN/1

It might look a bit cryptic, but it should work for your sample data.
Tell me if it helps!

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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