AWS SDK Version 4 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Creates or updates a log alarm. A log alarm evaluates the results of a CloudWatch Logs scheduled query against the configured threshold and comparison operator to determine its state.

When you create a log alarm, the operation creates a service-managed CloudWatch Logs scheduled query that runs the query string you provide on the schedule you configure. Each scheduled query execution returns one or more aggregated values determined by the AggregationExpression, and each aggregated value is compared against the alarm Threshold to determine the alarm state. The alarm uses M-out-of-N evaluation: if QueryResultsToAlarm out of the most recent QueryResultsToEvaluate query results breach the threshold, the alarm transitions to ALARM.

Log alarms support the alarm states (OK, ALARM, INSUFFICIENT_DATA). Configure transition actions using OKActions, AlarmActions, and InsufficientDataActions.

If you call this operation with the name of an existing log alarm, the operation replaces the previous configuration of that alarm.

Permissions

To create or update a log alarm, you must have the cloudwatch:PutLogAlarm permission. The IAM role specified in ScheduledQueryRoleARN must grant the CloudWatch Alarms service permission to execute scheduled queries on the specified log groups. If you set ActionLogLineCount, the role specified in ActionLogLineRoleArn must grant permission to retrieve log events for inclusion in alarm notifications.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to PutLogAlarmAsync.

Namespace: Amazon.CloudWatch
Assembly: AWSSDK.CloudWatch.dll
Version: 3.x.y.z

Syntax

C#
public abstract PutLogAlarmResponse PutLogAlarm(
         PutLogAlarmRequest request
)

Parameters

request
Type: Amazon.CloudWatch.Model.PutLogAlarmRequest

Container for the necessary parameters to execute the PutLogAlarm service method.

Return Value


The response from the PutLogAlarm service method, as returned by CloudWatch.

Exceptions

ExceptionCondition
LimitExceededException The quota for alarms for this customer has already been reached.
ResourceConflictException The operation could not be completed because the request conflicts with the current state of the alarm or its underlying scheduled query resource.

Version Information

.NET Framework:
Supported in: 4.7.2 and newer

See Also