|
StorageBlobLogs |
|
// parse authentication details |
|
| extend IP = tostring(split(CallerIpAddress, ":")[0]) |
|
| extend key = tostring(extract("(.*?)\\(", 1, AuthenticationHash)) |
|
| extend key_hash = tostring(extract(".*?\\((.*?)\\)", 1, AuthenticationHash)) |
|
| extend sas_hash = tostring(extract("SasSignature\\((.*?)\\)", 1, AuthenticationHash)) |
|
// group user-agent header by user-agent field and by well-known client id and by well-known path |
|
| extend UA = case( |
|
UserAgentHeader startswith "azsdk-java-azure-storage-blob", "azsdk-java-azure-storage-blob", |
|
UserAgentHeader startswith "Microsoft Azure Storage Explorer", "Microsoft Azure Storage Explorer", |
|
UserAgentHeader startswith "Mozilla/5.0", "Browser_or_browserlike", |
|
UserAgentHeader startswith "AzureDataFactoryCopy", "AzureDataFactoryCopy", |
|
UserAgentHeader endswith "Azure Synapse Analytics/Spark/", "Azure Synapse Analytics/Spark", |
|
UserAgentHeader startswith "Azure-Storage/", "Azure-Storage | .NET library", |
|
key == "system-1", "MSFT internal processes", |
|
UserAgentHeader) |
|
// parse SAS token st and se & calculate diff |
|
| extend url = parse_url(Uri) |
|
| extend SAS_st = todatetime(url_decode(coalesce(url["Query Parameters"]["st"], ""))), SAS_se = todatetime(url_decode(coalesce(url["Query Parameters"]["se"], ""))) |
|
| extend diff = SAS_se - TimeGenerated |
|
| extend diff_days = diff / timespan(24h) |
|
| extend diff_bins = case( |
|
diff_days < 1, 1, |
|
diff_days < 7, 7, |
|
diff_days < 31, 30, |
|
isnull( diff_days), dynamic(null), |
|
9999 |
|
) |
|
| extend splittedPath = split(url["Path"], "/") |
|
//| extend filenameslashcount = array_length(splittedPath) |
|
| extend container = tostring(splittedPath[1]) |
|
// filter data |
|
| where AuthenticationType == "SAS" |
|
//| finally summarize data |
|
// |
|
//| summarize count() by bin(diff_days, 1) |
|
//| summarize count() by diff_bins |
|
| summarize count() by |
|
AuthenticationType |
|
, key, key_hash, sas_hash |
|
, IP |
|
, UA |
|
, diff_bins |
|
, container |
|
, AccountName |
|
//, bin(TimeGenerated, 1d) |
|
// sort by IP |
|
| extend ipv4number = parse_ipv4(IP) |
|
| order by AccountName asc, ipv4number asc |
|
| where diff_bins > 999 |
|
//| order by TimeGenerated asc, IP asc |
|
//| summarize count() by bin(TimeGenerated, 1d), UserAgentHeader, IP |
|
//| order by TimeGenerated desc |
|
//| summarize count() by key |
|
|
|
// list SAS token usage with large SAS token lifetime |