You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Postman向Azure Application Insights发送日志消息?

通过Postman向Azure Application Insights发送日志消息的步骤

你不需要在创建Application Insights实例的API中配置日志属性,直接使用Application Insights Ingestion API即可发送日志,具体操作如下:

1. 获取凭据

登录Azure门户,找到你的Application Insights实例:

  • 在「概述」页面复制Instrumentation Key(或推荐使用的Connection String)

2. 构造Postman请求

请求基本信息

  • 方法:POST
  • URL:https://dc.services.visualstudio.com/v2/track(Azure中国区请用https://dc.applicationinsights.azure.cn/v2/track)

请求头

选择以下任意一种凭据方式设置请求头:

  • 使用Instrumentation Key:
    • Content-Type: application/json
    • Authorization: InstrumentationKey=你的Instrumentation密钥
  • 使用Connection String:
    • Content-Type: application/json
    • x-ms-AI-ConnectionString: 你的Connection String

请求体(JSON格式)

替换其中的你的Instrumentation密钥和时间字段,发送一条简单的信息日志:

{
  "name": "Microsoft.ApplicationInsights.你的Instrumentation密钥.Trace",
  "time": "2024-05-20T12:34:56.789Z",
  "iKey": "你的Instrumentation密钥",
  "tags": {
    "ai.cloud.role": "Postman测试",
    "ai.cloud.roleInstance": "Postman客户端"
  },
  "data": {
    "baseType": "MessageData",
    "baseData": {
      "ver": 2,
      "message": "这是一条来自Postman的测试日志",
      "severityLevel": "Information"
    }
  }
}

3. 验证日志

  • 发送请求后,收到200 OK响应即表示发送成功
  • 登录Azure门户,进入该Application Insights实例的「日志」页面,运行查询:
    traces | where message contains "测试日志"
    
    即可查询到刚发送的日志内容

内容的提问来源于stack exchange,提问作者Nandhini Packirisamy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 09:54:15