问题一:.  如何在用REST API获取活动日志时,控制输出的项?

【答】参考REST API对于获取活动日志的说明接口,在参数是$filter$select中可以分别控制过滤条件输出项

GET https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter={$filter}&$select={$select}

注:management.chinacloudapi.cn为中国区Azure的管理终结点,management.azure.com为全球Azure的管理终结点

URI Parameters

Name Description
$filter

Reduces the set of data collected.
This argument is required and it also requires at least the start date/time.

The $filter argument is very restricted and allows only the following patterns.
List events for a resource group:

$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
List events for resource:

$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
List events for a subscription in a time range:

$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.
List events for a resource provider:

$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.
List events for a correlation Id:

$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.

NOTE: No other syntax is allowed.

$select

Used to fetch events with only the given properties.
The $select argument is a comma separated list of property names to be returned.

Possible values are:

authorizationclaimscorrelationIddescriptioneventDataId,

eventNameeventTimestamphttpRequestleveloperationId,

operationNamepropertiesresourceGroupNameresourceProviderName,

resourceIdstatussubmissionTimestampsubStatussubscriptionId

在Filter和select可以配置的每一项说明,请查看文末的附录一

问题二:是否可以往Data Lake中注入Json格式文件?

【答】根据官方文档示例,如果使用Databricks进行(SQL查询语句)进行数据分析,是支持Json格式的数据,示例中使用的Json格式如下图所示:

参考使用 Databricks 分析数据一文: https://docs.azure.cn/zh-cn/storage/blobs/data-lake-storage-quickstart-create-databricks-account#ingest-sample-data

问题三:如何用C#向Data Lake中插入数据文件?

【答】可以,需要先安装 Azure.Storage.Files.DataLake NuGet 包。然后添加如下引用

using Azure.Storage.Files.DataLake;
using Azure.Storage.Files.DataLake.Models;
using Azure.Storage;
using System.IO;
using Azure;

将文件上传到目录,则参考以下代码即可:

public async Task UploadFile(DataLakeFileSystemClient fileSystemClient)
{
DataLakeDirectoryClient directoryClient =
fileSystemClient.GetDirectoryClient("my-directory"); DataLakeFileClient fileClient = await directoryClient.CreateFileAsync("uploaded-file.txt"); FileStream fileStream =
File.OpenRead("C:\\file-to-upload.txt"); long fileSize = fileStream.Length; await fileClient.AppendAsync(fileStream, offset: 0); await fileClient.FlushAsync(position: fileSize); }

完整实例参考使用 .NET 管理 Azure Data Lake Storage Gen2https://docs.azure.cn/zh-cn/storage/blobs/data-lake-storage-directory-file-acl-dotnet#upload-a-file-to-a-directory

附录一:在$Filter和$select可配置的选择项的EventData属性

The Azure event log entries are of type EventData

Name Type Description
authorization

The sender authorization information.

caller
  • string

the email address of the user who has performed the operation,

the UPN claim or SPN claim based on availability.

category

the event category.

claims
  • object

key value pairs to identify ARM permissions.

correlationId
  • string

the correlation Id, usually a GUID in the string format.

The correlation Id is shared among the events that belong to the same uber operation.

description
  • string

the description of the event.

eventDataId
  • string

the event data Id. This is a unique identifier for an event.

eventName

the event name. This value should not be confused with OperationName.

For practical purposes, OperationName might be more appealing to end users.

eventTimestamp
  • string

the timestamp of when the event was generated by the Azure service processing the

request corresponding the event. It in ISO 8601 format.

httpRequest

the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress'

(IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT).

id
  • string

the Id of this event as required by ARM for RBAC. It contains the EventDataID

and a timestamp information.

level

the event level

operationId
  • string

It is usually a GUID shared among the events corresponding to single operation.

This value should not be confused with EventName.

operationName

the operation name.

properties
  • object

the set of <Key, Value> pairs (usually a Dictionary<String, String>)

that includes details about the event.

resourceGroupName
  • string

the resource group name of the impacted resource.

resourceId
  • string

the resource uri that uniquely identifies the resource that caused this event.

resourceProviderName

the resource provider name of the impacted resource.

resourceType

the resource type

status

a string describing the status of the operation.

Some typical values are: Started, In progress, Succeeded, Failed, Resolved.

subStatus

the event sub status.

Most of the time, when included, this captures the HTTP status code of the REST call.

Common values are:

OK (HTTP Status Code: 200),

Created (HTTP Status Code: 201),

Accepted (HTTP Status Code: 202),

No Content (HTTP Status Code: 204),

Bad Request(HTTP Status Code: 400),

Not Found (HTTP Status Code: 404),

Conflict (HTTP Status Code: 409),

Internal Server Error (HTTP Status Code: 500),

Service Unavailable (HTTP Status Code:503),

Gateway Timeout (HTTP Status Code: 504)

submissionTimestamp
  • string

the timestamp of when the event became available for querying via this API.

It is in ISO 8601 format. This value should not be confused eventTimestamp.

As there might be a delay between the occurrence time of the event,

and the time that the event is submitted to the Azure logging infrastructure.

subscriptionId
  • string

the Azure subscription Id usually a GUID.

tenantId
  • string

the Azure tenant Id

【Azure Developer】使用REST API获取Activity Logs、传入Data Lake的数据格式问题的更多相关文章

  1. 【Azure Developer】使用Postman获取Azure AD中注册应用程序的授权Token,及为Azure REST API设置Authorization

    Azure Active Directory (Azure AD) is Microsoft's cloud-based identity and access management service, ...

  2. 【Azure Developer】使用 CURL 获取 Key Vault 中 Secrets 中的值

    问题描述 在使用CURL通过REST API获取Azure Key Vaualt的Secrets值,提示Missing Token, 问如何来生成正确的Token呢? # curl 命令 curl - ...

  3. 【Azure Developer】使用Microsoft Graph API 批量创建用户,先后遇见的三个错误及解决办法

    问题描述 在先前的一篇博文中,介绍了如何使用Microsoft Graph API来创建Azure AD用户(博文参考:[Azure Developer]使用Microsoft Graph API 如 ...

  4. 【Azure Developer】解决Azure Key Vault管理Storage的示例代码在中国区Azure遇见的各种认证/授权问题 - C# Example Code

    问题描述 使用Azure密钥保管库(Key Vault)来托管存储账号(Storage Account)密钥的示例中,从Github中下载的示例代码在中国区Azure运行时候会遇见各种认证和授权问题, ...

  5. Databricks 第8篇:把Azure Data Lake Storage Gen2 (ADLS Gen 2)挂载到DBFS

    DBFS使用dbutils实现存储服务的装载(mount.挂载),用户可以把Azure Data Lake Storage Gen2和Azure Blob Storage 账户装载到DBFS中.mou ...

  6. 构建企业级数据湖?Azure Data Lake Storage Gen2实战体验(下)

    相较传统的重量级OLAP数据仓库,“数据湖”以其数据体量大.综合成本低.支持非结构化数据.查询灵活多变等特点,受到越来越多企业的青睐,逐渐成为了现代数据平台的核心和架构范式. 作为微软Azure上最新 ...

  7. Azure Data Lake Storage Gen2实战体验

    相较传统的重量级OLAP数据仓库,“数据湖”以其数据体量大.综合成本低.支持非结构化数据.查询灵活多变等特点,受到越来越多企业的青睐,逐渐成为了现代数据平台的核心和架构范式. 作为微软Azure上最新 ...

  8. 【Azure Developer】使用 Microsoft Graph API 获取 AAD User 操作示例

    问题描述 查看官方文档" Get a user " , 产生了一个操作示例的想法,在中国区Azure环境中,演示如何获取AAD User信息. 问题解答 使用Microsoft G ...

  9. 【Azure Developer】使用 Microsoft Authentication Libraries (MSAL) 如何来获取Token呢 (通过用户名和密码方式获取Access Token)

    问题描述 在上一篇博文<[Azure Developer]使用 adal4j(Azure Active Directory authentication library for Java)如何来 ...

  10. 【Azure Developer】【Python 】使用 azure.identity 和 azure.common.credentials 获取Azure AD的Access Token的两种方式

    问题描述 使用Python代码,展示如何从Azure AD 中获取目标资源的 Access Token. 如要了解如何从AAD中获取 client id,client secret,tenant id ...

随机推荐

  1. KylinV10升级部分软件的简单方法

    背景 2022-12-26有同事晚上在群里反馈客户现场的测试环境内存紧张. 我这边第一反应是进程重复了,导致内存使用量飙升. 告知现场使用 ps -ef |grep java |grep caf 发现 ...

  2. 【小测试】golang中数组边界检查的开销大约是1.87%~3.12%

    作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢! cnblogs博客 zhihu Github 公众号:一本正经的瞎扯 对比C/C++, golang等类型安全的语言会在数组访问 ...

  3. ClickHouse(22)ClickHouse集成HDFS表引擎详细解析

    HDFS 这个引擎提供了与Apache Hadoop生态系统的集成,允许通过ClickHouse管理HDFS上的数据.这个引擎提供了Hadoop的特定功能. 用法 ENGINE = HDFS(URI, ...

  4. 通过Unity导出的Android Studio和Google安卓原生工程的结构图对比

    使用Unity导出Android Studio工程前建议查看我之前的文章<Unity2019及Unity2020打包android的环境配置>,替换或修改Unity安装目录下的basePr ...

  5. 【二】MADDPG多智能体算法实现(parl)【追逐游戏复现】

    相关文章: [一]MADDPG-单智能体|多智能体总结(理论.算法) [二]MADDPG多智能体深度强化学习算法算法实现(parl)--[追逐游戏复现] 程序链接:直接fork:MADDPG多智能体深 ...

  6. 4.5 C++ Boost 文件目录操作库

    Boost 库是一个由C/C++语言的开发者创建并更新维护的开源类库,其提供了许多功能强大的程序库和工具,用于开发高质量.可移植.高效的C应用程序.Boost库可以作为标准C库的后备,通常被称为准标准 ...

  7. Qt信号槽原理

    1.说明 使用Qt已经好几年了,一直以为自己懂Qt,熟悉Qt,使用起来很是熟练,无论什么项目,都喜欢用Qt编写.但真正去看Qt的源码,去理解Qt的思想也就近两年的事. 本次就着重介绍一下Qt的核心功能 ...

  8. 【链表】单链表的介绍和基本操作(C语言实现)【保姆级别详细教学】

    单链表 文章目录 前言 单链表基本介绍 基本结构 与顺序表的区别以及学习单链表的必要性 单链表的实现 结点的定义以及头指针的创建 单链表的遍历(打印接口的实现)[重点] 开辟结点接口 尾插接口 尾删接 ...

  9. FDConnection的事务测试讲解。。

    总之用事务的宗旨是: 1.不用嵌套事务EnableNested设置为False 2.事务一定要回滚,避免发生异常的情况下,没有回滚 造成,不可估量的错误. try frmClientDm.MyMain ...

  10. 《ASP.NET Core 微服务实战》-- 读书笔记(第7章)

    第 7 章 开发 ASP.NET Core Web 应用 ASP.NET Core 基础 在本章,我们将从一个命令行应用开始,并且在不借助任何模板,脚手架和向导的情况下,最终得到一个功能完整的 Web ...