您可以尝试使用Advanced Filter
. data.api String ends with FlushWithClose
我的 Azure 函数在 blob 上传时执行多次的原因是因为AppendFile
为 blob 上传执行的每个操作都创建了一条 EventGrid 消息。
我发现(通过反复试验)Azure 数据工厂使用一系列 API 调用将单个 Blob 写入 Blob 存储。
最终看起来像这样:
CreateFilePath
LeaseFile
AppendFile
AppendFile
AppendFile
(每个追加都会放置一块 blob,直到 blob 完成)
FlushFile
(这是文件已完成的实际指示;因此上面显示了高级过滤器)
LeaseFile
下面是一个示例查询,您可以自己查看此上传流程:
- 注意:您需要
Uri
上传到 blob 容器的示例文件
//==================================================//
// Author: Eric
// Created: 2021-05-26 0900
// Query: ADF-to-Blob Storage reference flow
// Purpose:
// To provide a reference flow of ADF-to-Blob Storage
// file uploads
//==================================================//
// Assign variables
//==================================================//
let varStart = ago(10d);
let varEnd = now();
let varStorageAccount = '<storageaccountname>';
let varStatus = 'Success';
let varSampleUri = 'https://<storageaccountname>.dfs.core.windows.net/<containername>/<parentfolder1>%2F<parentfolder2>%2F<samplefilename.extension>'
//==================================================//
// Filter table
//==================================================//
StorageBlobLogs
| where TimeGenerated between (varStart .. varEnd)
and AccountName == varStorageAccount
and StatusText == varStatus
and split(Uri, '?')[0] == varSampleUri
//==================================================//
// Group and parse results
//==================================================//
| summarize
count() by OperationName,
CorrelationId,
TimeGenerated,
UserAgent = tostring(split(UserAgentHeader, ' ')[0]),
RequesterAppId,
AccountName,
ContainerName = tostring(split(tostring(parse_url(url_decode(Uri))['Path']), '/')[1]),
FileName = tostring(split(tostring(parse_url(url_decode(Uri))['Path']), '/')[-1]),
ChunkSize = format_bytes(RequestBodySize, 2, 'MB'),
StatusCode,
StatusText
| order by TimeGenerated asc
从不同来源(Azure 数据工厂、Azure 存储资源管理器、Python/C# SDK、Azure 门户等)上传示例并查看它们使用的不同 API 方法很有趣。事实上,您可能需要这样做才能拨入您的日志记录和警报。
太糟糕了,这些方法没有跨工具标准化,因为这个特定的问题是你自己发现的一个巨大的痛苦!
同样,在这种情况下,EventGridAdvanced Filters
是您的朋友。