Reporting

How to generate report of Bandwidth usage per user and URL

newcomer
Engager

Hi,

 

I'm trying to generate a report with the following information

-Total Bandwidth for each user

-List of top 3 (Bandwidth usage) URLs for each user

-Bandwidth for each URL

For example

Example.JPG

 

Thank you!

Labels (2)
0 Karma
1 Solution

marysan
Communicator

I can't understand URL Category field role ! so I did it without considering URL Category
In addition I converted bytes to MB AND GB with division to 3145728 and 1073741824
this must work for you :

index=Myindex  url=* user="*" bytes=*

|eventstats sum(bytes) as TotalBandwidth_user by user
| eval TotalBandwidth_user=(TotalBandwidth_user/1073741824)
|eventstats sum(bytes) as TotalBandwidth_url by url
| eval TotalBandwidth_url=(TotalBandwidth_url/3145728)
| table user,TotalBandwidth_url,TotalBandwidth_user,url
| dedup user,TotalBandwidth_url,TotalBandwidth_user,url
|sort -TotalBandwidth_url
| stats list(url) as url , list(TotalBandwidth_url) as TotalBandwidth_url , values(TotalBandwidth_user) as TotalBandwidth_user(GB) by user
| eval top_TotalBandwidth_url(MB)=mvindex(TotalBandwidth_url,0,2)
| eval top_url=mvindex(url,0,2)
| table user,TotalBandwidth_user(GB),top_url,top_TotalBandwidth_url(MB)

View solution in original post

marysan
Communicator

I can't understand URL Category field role ! so I did it without considering URL Category
In addition I converted bytes to MB AND GB with division to 3145728 and 1073741824
this must work for you :

index=Myindex  url=* user="*" bytes=*

|eventstats sum(bytes) as TotalBandwidth_user by user
| eval TotalBandwidth_user=(TotalBandwidth_user/1073741824)
|eventstats sum(bytes) as TotalBandwidth_url by url
| eval TotalBandwidth_url=(TotalBandwidth_url/3145728)
| table user,TotalBandwidth_url,TotalBandwidth_user,url
| dedup user,TotalBandwidth_url,TotalBandwidth_user,url
|sort -TotalBandwidth_url
| stats list(url) as url , list(TotalBandwidth_url) as TotalBandwidth_url , values(TotalBandwidth_user) as TotalBandwidth_user(GB) by user
| eval top_TotalBandwidth_url(MB)=mvindex(TotalBandwidth_url,0,2)
| eval top_url=mvindex(url,0,2)
| table user,TotalBandwidth_user(GB),top_url,top_TotalBandwidth_url(MB)

newcomer
Engager

Thank you so much, Marysan!

That's exactly what I wanted.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...