Class CfnLogAlarm

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ILogAlarmRef, IEnvironmentAware, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.133.0 (build 0f43e37)", date="2026-06-16T16:14:20.700Z") @Stability(Stable) public class CfnLogAlarm extends CfnResource implements IInspectable, ILogAlarmRef, ITaggableV2
Resource Type definition for AWS::CloudWatch::LogAlarm.

A LogAlarm evaluates scheduled query results from CloudWatch Logs and triggers actions when thresholds are breached.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.cloudwatch.*;
 CfnLogAlarm cfnLogAlarm = CfnLogAlarm.Builder.create(this, "MyCfnLogAlarm")
         .comparisonOperator("comparisonOperator")
         .queryResultsToAlarm(123)
         .queryResultsToEvaluate(123)
         .scheduledQueryConfiguration(ScheduledQueryConfigurationProperty.builder()
                 .aggregationExpression("aggregationExpression")
                 .logGroupIdentifiers(List.of("logGroupIdentifiers"))
                 .queryLanguage("queryLanguage")
                 .queryString("queryString")
                 .scheduleConfiguration(ScheduleConfigurationProperty.builder()
                         .scheduleExpression("scheduleExpression")
                         // the properties below are optional
                         .endTimeOffset(123)
                         .startTimeOffset(123)
                         .build())
                 .scheduledQueryRoleArn("scheduledQueryRoleArn")
                 .build())
         .threshold(123)
         // the properties below are optional
         .actionLogLineCount(123)
         .actionLogLineRoleArn("actionLogLineRoleArn")
         .actionsEnabled(false)
         .alarmActions(List.of("alarmActions"))
         .alarmDescription("alarmDescription")
         .alarmName("alarmName")
         .insufficientDataActions(List.of("insufficientDataActions"))
         .okActions(List.of("okActions"))
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .treatMissingData("treatMissingData")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnLogAlarm

      protected CfnLogAlarm(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnLogAlarm

      protected CfnLogAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnLogAlarm

      @Stability(Stable) public CfnLogAlarm(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnLogAlarmProps props)
      Create a new AWS::CloudWatch::LogAlarm.

      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • arnForLogAlarm

      @Stability(Stable) @NotNull public static String arnForLogAlarm(@NotNull ILogAlarmRef resource)
      Parameters:
      resource - This parameter is required.
    • isCfnLogAlarm

      @Stability(Stable) @NotNull public static Boolean isCfnLogAlarm(@NotNull Object x)
      Checks whether the given object is a CfnLogAlarm.

      Parameters:
      x - This parameter is required.
    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The ARN of the log alarm.
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getCfnPropertyNames

      @Stability(Stable) @NotNull protected Map<String,String> getCfnPropertyNames()
      Overrides:
      getCfnPropertyNames in class CfnResource
    • getLogAlarmRef

      @Stability(Stable) @NotNull public LogAlarmReference getLogAlarmRef()
      A reference to a LogAlarm resource.
      Specified by:
      getLogAlarmRef in interface ILogAlarmRef
    • getComparisonOperator

      @Stability(Stable) @NotNull public String getComparisonOperator()
      The arithmetic operation to use when comparing the specified threshold and the query results.
    • setComparisonOperator

      @Stability(Stable) public void setComparisonOperator(@NotNull String value)
      The arithmetic operation to use when comparing the specified threshold and the query results.
    • getQueryResultsToAlarm

      @Stability(Stable) @NotNull public Number getQueryResultsToAlarm()
      The number of query results that must be breaching to trigger the alarm.
    • setQueryResultsToAlarm

      @Stability(Stable) public void setQueryResultsToAlarm(@NotNull Number value)
      The number of query results that must be breaching to trigger the alarm.
    • getQueryResultsToEvaluate

      @Stability(Stable) @NotNull public Number getQueryResultsToEvaluate()
      The number of query results over which data is compared to the specified threshold.
    • setQueryResultsToEvaluate

      @Stability(Stable) public void setQueryResultsToEvaluate(@NotNull Number value)
      The number of query results over which data is compared to the specified threshold.
    • getScheduledQueryConfiguration

      @Stability(Stable) @NotNull public Object getScheduledQueryConfiguration()
      The scheduled query configuration for the log alarm.

      Returns union: either IResolvable or CfnLogAlarm.ScheduledQueryConfigurationProperty

    • setScheduledQueryConfiguration

      @Stability(Stable) public void setScheduledQueryConfiguration(@NotNull IResolvable value)
      The scheduled query configuration for the log alarm.
    • setScheduledQueryConfiguration

      @Stability(Stable) public void setScheduledQueryConfiguration(@NotNull CfnLogAlarm.ScheduledQueryConfigurationProperty value)
      The scheduled query configuration for the log alarm.
    • getThreshold

      @Stability(Stable) @NotNull public Number getThreshold()
      The value to compare against the results of the scheduled query evaluation.
    • setThreshold

      @Stability(Stable) public void setThreshold(@NotNull Number value)
      The value to compare against the results of the scheduled query evaluation.
    • getActionLogLineCount

      @Stability(Stable) @Nullable public Number getActionLogLineCount()
      The number of log lines to include in alarm notifications.
    • setActionLogLineCount

      @Stability(Stable) public void setActionLogLineCount(@Nullable Number value)
      The number of log lines to include in alarm notifications.
    • getActionLogLineRoleArn

      @Stability(Stable) @Nullable public String getActionLogLineRoleArn()
      The ARN of the IAM role that grants CloudWatch permissions to fetch log lines for alarm notifications.
    • setActionLogLineRoleArn

      @Stability(Stable) public void setActionLogLineRoleArn(@Nullable String value)
      The ARN of the IAM role that grants CloudWatch permissions to fetch log lines for alarm notifications.
    • getActionsEnabled

      @Stability(Stable) @Nullable public Object getActionsEnabled()
      Indicates whether actions should be executed during any changes to the alarm state.

      Returns union: either Boolean or IResolvable

    • setActionsEnabled

      @Stability(Stable) public void setActionsEnabled(@Nullable Boolean value)
      Indicates whether actions should be executed during any changes to the alarm state.
    • setActionsEnabled

      @Stability(Stable) public void setActionsEnabled(@Nullable IResolvable value)
      Indicates whether actions should be executed during any changes to the alarm state.
    • getAlarmActions

      @Stability(Stable) @Nullable public List<String> getAlarmActions()
      The list of actions to execute when this alarm transitions into an ALARM state from any other state.
    • setAlarmActions

      @Stability(Stable) public void setAlarmActions(@Nullable List<String> value)
      The list of actions to execute when this alarm transitions into an ALARM state from any other state.
    • getAlarmDescription

      @Stability(Stable) @Nullable public String getAlarmDescription()
      The description of the log alarm.
    • setAlarmDescription

      @Stability(Stable) public void setAlarmDescription(@Nullable String value)
      The description of the log alarm.
    • getAlarmName

      @Stability(Stable) @Nullable public String getAlarmName()
      The name of the log alarm.
    • setAlarmName

      @Stability(Stable) public void setAlarmName(@Nullable String value)
      The name of the log alarm.
    • getInsufficientDataActions

      @Stability(Stable) @Nullable public List<String> getInsufficientDataActions()
      The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
    • setInsufficientDataActions

      @Stability(Stable) public void setInsufficientDataActions(@Nullable List<String> value)
      The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
    • getOkActions

      @Stability(Stable) @Nullable public List<String> getOkActions()
      The actions to execute when this alarm transitions to the OK state from any other state.
    • setOkActions

      @Stability(Stable) public void setOkActions(@Nullable List<String> value)
      The actions to execute when this alarm transitions to the OK state from any other state.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      A list of key-value pairs to associate with the log alarm.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      A list of key-value pairs to associate with the log alarm.
    • getTreatMissingData

      @Stability(Stable) @Nullable public String getTreatMissingData()
      Sets how this alarm is to handle missing data points.
    • setTreatMissingData

      @Stability(Stable) public void setTreatMissingData(@Nullable String value)
      Sets how this alarm is to handle missing data points.