Azure Log Analytics通过Workspace ID和PRIMARY KEY使用Rest API查询/获取数据 [英] Azure Log Analytics Query/fetch data using rest api by Workspace id and PRIMARY KEY

查看:91
本文介绍了Azure Log Analytics通过Workspace ID和PRIMARY KEY使用Rest API查询/获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前我正在使用Azure日志分析.
我可以在Azure日志分析上发布数据,也可以在Azure门户上查看.

Currently I am using Azure log analytics.
I can able to post data on azure log analytics and able to see on azure portal as well.

使用以下引用来发布/记录数据,并且可以正常工作.:
https://docs.microsoft.com/zh-cn/azure/log-analytics/log-analytics-data-collector-api#c-sample

Using below reference to post/log data and It's working fine.:
https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-collector-api#c-sample


但是,当我尝试在日志分析中使用HttpClient查询/获取数据时,无法访问此数据.
参考:
https://dev.loganalytics.io/documentation/Authorization/API-keys

使用下面的示例API,我可以获取数据:


But when I tried to query/fetch data using HttpClient on log analytics, I am not able to access this data.
Reference:
https://dev.loganalytics.io/documentation/Authorization/API-keys

Using below sample api I can able to fetch data:

POST https://api.loganalytics.io/v1/workspaces/DEMO_WORKSPACE/query
X-Api-Key: DEMO_KEY
Content-Type: application/json

{
    "query": "AzureActivity | summarize count() by Category"
}

请向我提供信息,如何获取数据以使用日志分析的工作区ID和主键?

我不想使用AAD身份验证: https://dev.loganalytics.io/documentation/Authorization/OAuth2

I don't want to use AAD Authentication: https://dev.loganalytics.io/documentation/Authorization/OAuth2

谢谢.

推荐答案

我建议您将此问题发送给Azure支持.据我了解,Log Analytics没有API密钥,但它具有工作空间密钥,据我所知,它们是不同的密钥.因此,API密钥身份验证不适用于查询数据.

I would advise you to address this to Azure Support. As far as I know Log Analytics does not have API key it has workspace key and to my understanding those are different keys. Because of that the API key authentication does not work on querying data.


这篇关于Azure Log Analytics通过Workspace ID和PRIMARY KEY使用Rest API查询/获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆