如何使用c#读取在blob中捕获的事件中心日志数据
我有simple logic app
, creates a text file
我想test whether the logic app created file is present in file storage
。
并且还想测试correlation id of logic app
的correlation id of logic app
的值
我创建了Event Hub
和In Logic app configure Diagnostic Settings to Stream to an event hub
。
现在Inside Event hub I have configure Capture option to Azure Storage which will create a blob file for events logs
我想知道如何使用c#代码检查事件blob中的2件事情?
我想查看以下内容 –
1.当Logic应用程序触发时,我想检查correlation_ID属性,我想我将从事件中心日志中获取该属性。
- 在Logic应用程序中,我正在创建一个txt文件,我想从事件中心日志中获取新创建的文件名。
关于以上2个问题的任何想法?
我试过这篇文章
但是每秒生成多个文件,究竟哪个文件包含我需要猜测的内容?
代码工作得很好 –
var storageAccount = CloudStorageAccount.Parse(connectionString); var blobClient = storageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference(containerName); var blob = container.GetBlockBlobReference(blobName); using (var stream = blob.OpenRead()) using (var reader = AvroContainer.CreateGenericReader(stream)) while (reader.MoveNext()) foreach (dynamic result in reader.Current.Objects) { var record = new AvroEventData(result); record.Dump(); }