Query Pack Queries - Update
Adds or Updates a specific Query within a Log Analytics QueryPack.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}/queries/{id}?api-version=2019-09-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
id
|
path | True |
string |
The id of a specific query defined in the Log Analytics QueryPack |
query
|
path | True |
string |
The name of the Log Analytics QueryPack resource. |
resource
|
path | True |
string |
The name of the resource group. The name is case insensitive. |
subscription
|
path | True |
string |
The ID of the target subscription. |
api-version
|
query | True |
string |
The API version to use for this operation. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
properties.body | True |
string |
Body of the query. |
properties.displayName | True |
string |
Unique display name for your query within the Query Pack. |
properties.description |
string |
Description of the query. |
|
properties.properties |
object |
Additional properties that can be set for the query. |
|
properties.related |
The related metadata items for the function. |
||
properties.tags |
object |
Tags associated with the query. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
The new or updated query contained within the Log Analytics QueryPack. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
QueryPatch
Sample request
PATCH https://management.azure.com/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/queryPacks/my-querypack/queries/a449f8af-8e64-4b3a-9b16-5a7165ff98c4?api-version=2019-09-01
{
"properties": {
"displayName": "Exceptions - New in the last 24 hours",
"description": "my description",
"body": "let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n",
"related": {
"categories": [
"analytics"
]
},
"tags": {
"my-label": [
"label1"
],
"my-other-label": [
"label2"
]
}
}
}
Sample response
{
"id": "/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack/queries/a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
"name": "a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
"type": "microsoft.operationalinsights/queryPacks/queries",
"systemData": {
"createdBy": "string",
"createdByType": "application",
"createdAt": "2020-02-03T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "application",
"lastModifiedAt": "2020-02-04T02:03:01.1974346Z"
},
"properties": {
"id": "a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
"timeCreated": "2019-08-15T10:30:32.5742324Z",
"author": "1809f206-263a-46f7-942d-4572c156b7e7",
"timeModified": "2019-08-15T10:30:32.5742324Z",
"displayName": "Exceptions - New in the last 24 hours",
"description": "my description",
"body": "let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n",
"related": {
"categories": [
"analytics"
]
},
"tags": {
"my-label": [
"label1"
],
"my-other-label": [
"label2"
]
}
}
}
Definitions
Name | Description |
---|---|
Error |
The resource management error additional info. |
Error |
The error detail. |
Error |
Error response |
Identity |
The type of identity that creates/modifies resources |
Log |
A Log Analytics QueryPack-Query definition. |
Related |
The related metadata items for the function. |
System |
Read only system data |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info |
object |
The additional info. |
type |
string |
The additional info type. |
ErrorDetail
The error detail.
Name | Type | Description |
---|---|---|
additionalInfo |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
ErrorResponse
Error response
Name | Type | Description |
---|---|---|
error |
The error object. |
IdentityType
The type of identity that creates/modifies resources
Name | Type | Description |
---|---|---|
application |
string |
|
key |
string |
|
managedIdentity |
string |
|
user |
string |
LogAnalyticsQueryPackQuery
A Log Analytics QueryPack-Query definition.
Name | Type | Description |
---|---|---|
id |
string |
Azure resource Id |
name |
string |
Azure resource name |
properties.author |
string |
Object Id of user creating the query. |
properties.body |
string |
Body of the query. |
properties.description |
string |
Description of the query. |
properties.displayName |
string |
Unique display name for your query within the Query Pack. |
properties.id |
string |
The unique ID of your application. This field cannot be changed. |
properties.properties |
object |
Additional properties that can be set for the query. |
properties.related |
The related metadata items for the function. |
|
properties.tags |
object |
Tags associated with the query. |
properties.timeCreated |
string |
Creation Date for the Log Analytics Query, in ISO 8601 format. |
properties.timeModified |
string |
Last modified date of the Log Analytics Query, in ISO 8601 format. |
systemData |
Read only system data |
|
type |
string |
Azure resource type |
Related
The related metadata items for the function.
Name | Type | Description |
---|---|---|
categories |
string[] |
The related categories for the function. |
resourceTypes |
string[] |
The related resource types for the function. |
solutions |
string[] |
The related Log Analytics solutions for the function. |
SystemData
Read only system data
Name | Type | Description |
---|---|---|
createdAt |
string |
The timestamp of resource creation (UTC) |
createdBy |
string |
An identifier for the identity that created the resource |
createdByType |
The type of identity that created the resource |
|
lastModifiedAt |
string |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
An identifier for the identity that last modified the resource |
lastModifiedByType |
The type of identity that last modified the resource |