kor_
kor_

Reputation: 1530

How to select multiple CustomDimensions from Azure Application Insights API?

I'm trying to select events that have three CustomDimensions fields set: MessageType, MessageName and MessageID.

The events also contain the content of the message, which can be quite large, so I don't want to get that in the response.

So I'm using the $select operator to select a subset of fields available in the events.

The $select query is as follows: id, timestamp, customDimensions/MessageID, customDimensions/MessageName, customDimensions/MessageType

No matter what I do I always get the last CustomDimension and not all three. Example response:

 "id": "bc33c887-e100-11e8-9830-effc6d3968d7",
  "timestamp": "2018-11-05T13:42:58.240Z",
  "customDimensions": {
    "MessageType": "RESPONSE"
  }

Is there a special syntax for selecting more CustomDimension fields from the events?

Upvotes: 0

Views: 1023

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29950

You can refer to this issue, and I have already mailed to MS for this issue, but no feedback now.

As a workaround, you can use this solution(You can ajust the ago(5h) as per your need),official document here:

https://api.applicationinsights.io/v1/apps/Your_application_id/query?query=events
| where timestamp >ago(5h)
|  project id, timestamp, customDimensions.MessageID, customDimensions.MessageName,customDimensions.MessageType

Then you can test it in postman like this: enter image description here

How to get the application id and api key:

Nav to azure portal -> your application insights -> API Access blade, then you can see the Application id.

Then click the Create API key button, in the create api key page, select the Read telemetry checkbox, then click Generate key button. Please remember the api key, if it's lost, you need to generate a new one.

enter image description here

enter image description here

Upvotes: 1

Related Questions