Last active
February 17, 2020 16:40
-
-
Save grigorescu/3179eb8ada4c6d4e154b to your computer and use it in GitHub Desktop.
Bro script to measure March Madness video streaming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculates metrics on March Madness video streaming, including | |
# unique IPs, total HTTP requests, and total bytes downloaded. | |
# Sample output: | |
# | |
# fields ts ts_delta app uniq_hosts hits bytes | |
# types time interval string count count count | |
# 1395331457.824587 900.000000 march-madness 4 569 164589761 | |
# 1395332324.854514 900.000000 march-madness 17 1917 704801124 | |
@load misc/app-stats | |
module AppStats; | |
event HTTP::log_http(rec: HTTP::Info) | |
{ | |
if ( rec?$host && rec?$referrer && rec?$uri && rec?$response_body_len ) | |
{ | |
if ( /http:\/\/www.ncaa.com\/march-madness-live\/game\// in rec$referrer && | |
/plugin=aasp-3/ in rec$uri ) | |
{ | |
SumStats::observe("apps.bytes", [$str="march-madness"], [$num=rec$response_body_len]); | |
SumStats::observe("apps.hits", [$str="march-madness"], [$str=cat(rec$id$orig_h)]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol, so awesome!