Splunk Search

Extract the meaningful fields from the logs

amitru
Engager

I want to get an API usage report per user and I am struggling with the Splunk Query for this, can someone please help with the query, I tried using rex but didn't get through.

 

In my app logs, I have a text like -

U87XXXX:ddddffggggggsss.REG.Currency [RestInterceptor]: RestRequest: URI : https://abc.net/api/curr

........  RequestBody: {"loginId": "U87XXXX"}

 

I want the output as

UserID                     URL                                                 COUNT 

U87XXXX        https://abc.net/api/curr                    5

U78XXXX       https://abc.net/api/xyz                     11 

 

Thanks in advance.

Labels (1)
0 Karma

Gr0und_Z3r0
Contributor

Hi @amitru 

Try something like this and then do a stats command to get insights.


 

|rex field=_raw "URI\s\:\s(?P<URL>[\w\:\/\.]+)"
|rex field=_raw "loginId\"\:\s\"(?P<UserID>[\w]+)\""
|stats count by UserID URL

 

Get Updates on the Splunk Community!

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...

[Live Demo] Watch SOC transformation in action with the reimagined Splunk Enterprise ...

Overwhelmed SOC? Splunk ES Has Your Back Tool sprawl, alert fatigue, and endless context switching are making ...

What’s New & Next in Splunk SOAR

Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us on ...