Skip to content

CloudWatchClient.put_log_alarm

rboto-cloudwatch==0.4.0 · Service index · Types

Model summary (excerpt): 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...

Install and imports

python -m pip install "rboto[cloudwatch]==0.4.0"
from rboto import CloudWatchClient
from collections.abc import Sequence
from rboto_cloudwatch.types import (
    ActionConfiguration,
    ComparisonOperator,
    ScheduledQueryConfiguration,
    Tag,
    WarmUpConfiguration,
)

Signature

async def put_log_alarm(
    *,
    alarm_name: str,
    scheduled_query_configuration: ScheduledQueryConfiguration,
    query_results_to_evaluate: int,
    query_results_to_alarm: int,
    threshold: float,
    comparison_operator: ComparisonOperator,
    alarm_description: str | None = None,
    action_log_line_count: int | None = None,
    action_log_line_role_arn: str | None = None,
    actions_enabled: bool | None = None,
    ok_actions: Sequence[str] | None = None,
    alarm_actions: Sequence[str] | None = None,
    insufficient_data_actions: Sequence[str] | None = None,
    treat_missing_data: str | None = None,
    tags: Sequence[Tag] | None = None,
    warm_up_configuration: WarmUpConfiguration | None = None,
    action_configuration: ActionConfiguration | None = None,
) -> None: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
alarm_name Yes The name for the alarm. This name must be unique within the Amazon Web Services account and Region.
scheduled_query_configuration Yes The configuration of the underlying CloudWatch Logs scheduled query that this alarm evaluates, including the query string, log groups, schedule, and aggregation expression.
query_results_to_evaluate Yes The number of most recent scheduled query results to evaluate against the threshold (the N in M-of-N evaluation). Valid range is 1 through 100.
query_results_to_alarm Yes The number of query results, out of the most recent QueryResultsToEvaluate results, that must breach the threshold to trigger the alarm to transition to ALARM (the M in M-of-N evaluation). Must be less than or equal to QueryResultsToEvaluate .
threshold Yes The value to compare with the aggregated query result.
comparison_operator Yes The arithmetic operation to use when comparing the aggregated query result and the threshold. The aggregated query result is used as the first operand. Valid values are GreaterThanThreshold , GreaterThanOrEqualToThreshold , LessThanThreshold , and LessThanOrEqualToThreshold .
alarm_description No The description for the alarm.
action_log_line_count No The number of log lines from the most recent scheduled query execution to include in alarm action notifications. Valid range is 0 through 50. The default is 0, which means no log lines are included.
action_log_line_role_arn No The Amazon Resource Name (ARN) of an IAM role that CloudWatch assumes to retrieve log events for inclusion in alarm action notifications. Required when ActionLogLineCount is greater than 0.
actions_enabled No Indicates whether actions should be executed during any changes to the alarm state. The default is true .
ok_actions No The actions to execute when this alarm transitions to the OK state from any other state. Each action is specified as an Amazon Resource Name (ARN). Valid Values: Amazon SNS actions: arn:aws:sns: region : account-id : sns-topic-name Lambda actions: Invoke the latest version of a Lambda function: arn:aws:lambda: region : account-id :function: function-name Invoke a specific version of a Lambda...
alarm_actions No The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN). Valid Values: Amazon SNS actions: arn:aws:sns: region : account-id : sns-topic-name Lambda actions: Invoke the latest version of a Lambda function: arn:aws:lambda: region : account-id :function: function-name Invoke a specific version of a...
insufficient_data_actions No The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN). Valid Values: Amazon SNS actions: arn:aws:sns: region : account-id : sns-topic-name Lambda actions: Invoke the latest version of a Lambda function: arn:aws:lambda: region : account-id :function: function-name Invoke a specific...
treat_missing_data No Sets how this alarm is to handle missing data points. Valid values are breaching , notBreaching , ignore , and missing . If this parameter is omitted, the default behavior of missing is used.
tags No A list of key-value pairs to associate with the alarm. You can use tags to categorize and manage your alarms.
warm_up_configuration No The warm-up configuration for the alarm. A warm-up period delays alarm evaluation after you create or update the alarm. The warm-up period reduces alarm noise from missing data while a new resource or service starts publishing data. For more information, see Alarm warm-up periods in the Amazon CloudWatch User Guide .
action_configuration No Settings that change the content of the notifications and events that the alarm sends when its state changes. These settings apply to the alarm's actions, whichever state triggers them.

Output

None.

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

ActionConfiguration, ComparisonOperator, ScheduledQueryConfiguration, Tag, WarmUpConfiguration

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudwatch.exceptions:

LimitExceededFaultError, ResourceConflictError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model