Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class PutQueryDefinitionCommandProtected

Creates or updates a query definition for CloudWatch Logs Insights. For more information, see Analyzing Log Data with CloudWatch Logs Insights.

To update a query definition, specify its queryDefinitionId in your request. The values of name, queryString, and logGroupNames are changed to the values that you specify in your update operation. No current values are retained from the current query definition. For example, imagine updating a current query definition that includes log groups. If you don't specify the logGroupNames parameter in your update operation, the query definition changes to contain no log groups.

You must have the logs:PutQueryDefinition permission to be able to perform this operation.

Example

Use a bare-bones client and the command you need to make an API call.

import { CloudWatchLogsClient, PutQueryDefinitionCommand } from "@aws-sdk/client-cloudwatch-logs"; // ES Modules import
// const { CloudWatchLogsClient, PutQueryDefinitionCommand } = require("@aws-sdk/client-cloudwatch-logs"); // CommonJS import
const client = new CloudWatchLogsClient(config);
const input = { // PutQueryDefinitionRequest
name: "STRING_VALUE", // required
queryDefinitionId: "STRING_VALUE",
logGroupNames: [ // LogGroupNames
"STRING_VALUE",
],
queryString: "STRING_VALUE", // required
clientToken: "STRING_VALUE",
};
const command = new PutQueryDefinitionCommand(input);
const response = await client.send(command);
// { // PutQueryDefinitionResponse
// queryDefinitionId: "STRING_VALUE",
// };

Param

PutQueryDefinitionCommandInput

Returns

PutQueryDefinitionCommandOutput

See

Throws

InvalidParameterException (client fault)

A parameter is specified incorrectly.

Throws

LimitExceededException (client fault)

You have reached the maximum number of resources that can be created.

Throws

ResourceNotFoundException (client fault)

The specified resource does not exist.

Throws

ServiceUnavailableException (server fault)

The service cannot complete the request.

Throws

CloudWatchLogsServiceException

Base exception class for all service exceptions from CloudWatchLogs service.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods