Use AWS CloudWatch to query logs, retrieve log events, inspect log groups and streams, read metrics and alarms, and publish custom metric data. Connect with an AWS access key ID and secret access key.
Choose Query Logs (Insights) for a query across log groups, or Get Log Events for one stream. Metric statistics use a time range and period; alarm actions report the current state. Pass results to later steps for incident investigation or threshold-based notifications.
Run Log Insights queries, list log groups, retrieve log events, list and get metrics, and monitor alarms. Requires AWS access key and secret access key.
Run a CloudWatch Log Insights query against one or more log groups
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key logGroupNamesarray Yes Log group names to query queryStringstring Yes CloudWatch Log Insights query string startTimenumber Yes Start time as Unix epoch seconds endTimenumber Yes End time as Unix epoch seconds limitnumber No Maximum number of results to return
Parameter Type Description resultsarray Query result rows (each row is a key/value map of field name to value) statisticsobject Query statistics ↳ bytesScanned number Total bytes of log data scanned ↳ recordsMatched number Number of log records that matched the query ↳ recordsScanned number Total log records scanned statusstring Query completion status (Complete, Failed, Cancelled, or Timeout)
Search log events across all streams in a log group by filter pattern and time range, without writing a Log Insights query
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key logGroupNamestring Yes CloudWatch log group name to search filterPatternstring No CloudWatch Logs filter pattern (e.g., "ERROR", "?ERROR ?Exception"). Matches all events if omitted. logStreamNamePrefixstring No Only search log streams whose name starts with this prefix startTimenumber No Start time as Unix epoch seconds endTimenumber No End time as Unix epoch seconds startFromHeadboolean No Return the earliest matching events first instead of the latest limitnumber No Maximum number of events to return
Parameter Type Description eventsarray Matching log events across all searched streams, sorted by timestamp ↳ logStreamName string Log stream the event belongs to ↳ timestamp number Event timestamp in epoch milliseconds ↳ message string Log event message ↳ ingestionTime number Ingestion time in epoch milliseconds
List available CloudWatch log groups
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key prefixstring No Filter log groups by name prefix limitnumber No Maximum number of log groups to return
Parameter Type Description logGroupsarray List of CloudWatch log groups with metadata ↳ logGroupName string Log group name ↳ arn string Log group ARN ↳ storedBytes number Total stored bytes ↳ retentionInDays number Retention period in days (if set) ↳ creationTime number Creation time in epoch milliseconds
Retrieve log events from a specific CloudWatch log stream
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key logGroupNamestring Yes CloudWatch log group name logStreamNamestring Yes CloudWatch log stream name startTimenumber No Start time as Unix epoch seconds endTimenumber No End time as Unix epoch seconds limitnumber No Maximum number of events to return
Parameter Type Description eventsarray Log events with timestamp, message, and ingestion time ↳ timestamp number Event timestamp in epoch milliseconds ↳ message string Log event message ↳ ingestionTime number Ingestion time in epoch milliseconds
List log streams within a CloudWatch log group
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key logGroupNamestring Yes CloudWatch log group name prefixstring No Filter log streams by name prefix limitnumber No Maximum number of log streams to return
Parameter Type Description logStreamsarray List of log streams with metadata, sorted by last event time (most recent first) unless a prefix filter is applied ↳ logStreamName string Log stream name ↳ lastEventTimestamp number Timestamp of the last log event in epoch milliseconds ↳ firstEventTimestamp number Timestamp of the first log event in epoch milliseconds ↳ creationTime number Stream creation time in epoch milliseconds ↳ storedBytes number Total stored bytes
Set (or clear, for never-expire) the retention period for a CloudWatch log group
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key logGroupNamestring Yes CloudWatch log group name retentionInDaysnumber No Days to retain log events (one of 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653). Omit to make events never expire.
Parameter Type Description successboolean Whether the retention policy was updated logGroupNamestring Log group the policy applies to retentionInDaysnumber Retention period in days, or null if events never expire
List available CloudWatch metrics
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namespacestring No Filter by namespace (e.g., AWS/EC2, AWS/Lambda) metricNamestring No Filter by metric name recentlyActiveboolean No Only show metrics active in the last 3 hours limitnumber No Maximum number of metrics to return
Parameter Type Description metricsarray List of metrics with namespace, name, and dimensions ↳ namespace string Metric namespace (e.g., AWS/EC2) ↳ metricName string Metric name (e.g., CPUUtilization) ↳ dimensions array Array of name/value dimension pairs
Get statistics for a CloudWatch metric over a time range
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namespacestring Yes Metric namespace (e.g., AWS/EC2, AWS/Lambda) metricNamestring Yes Metric name (e.g., CPUUtilization, Invocations) startTimenumber Yes Start time as Unix epoch seconds endTimenumber Yes End time as Unix epoch seconds periodnumber Yes Granularity in seconds (e.g., 60, 300, 3600) statisticsarray Yes Statistics to retrieve (Average, Sum, Minimum, Maximum, SampleCount) dimensionsstring No Dimensions as JSON (e.g., {"InstanceId": "i-1234"})
Parameter Type Description labelstring Metric label returned by CloudWatch datapointsarray Datapoints sorted by timestamp with statistics values ↳ timestamp number Datapoint timestamp in epoch milliseconds ↳ average number Average statistic value ↳ sum number Sum statistic value ↳ minimum number Minimum statistic value ↳ maximum number Maximum statistic value ↳ sampleCount number Sample count statistic value ↳ unit string Unit of the metric
Publish a custom metric data point to CloudWatch
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namespacestring Yes Metric namespace (e.g., Custom/MyApp) metricNamestring Yes Name of the metric valuenumber Yes Metric value to publish unitstring No Unit of the metric (e.g., Count, Seconds, Bytes) dimensionsstring No JSON string of dimension name/value pairs
Parameter Type Description successboolean Whether the metric was published successfully namespacestring Metric namespace metricNamestring Metric name valuenumber Published metric value unitstring Metric unit timestampstring Timestamp when the metric was published
List and filter CloudWatch alarms
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key alarmNamePrefixstring No Filter alarms by name prefix stateValuestring No Filter by alarm state (OK, ALARM, INSUFFICIENT_DATA) alarmTypestring No Filter by alarm type (MetricAlarm, CompositeAlarm) limitnumber No Maximum number of alarms to return
Parameter Type Description alarmsarray List of CloudWatch alarms with state and configuration ↳ alarmName string Alarm name ↳ alarmArn string Alarm ARN ↳ stateValue string Current state (OK, ALARM, INSUFFICIENT_DATA) ↳ stateReason string Human-readable reason for the state ↳ metricName string Metric name (MetricAlarm only) ↳ namespace string Metric namespace (MetricAlarm only) ↳ threshold number Threshold value (MetricAlarm only) ↳ stateUpdatedTimestamp number Epoch ms when state last changed
Retrieve state-change and configuration history for CloudWatch alarms
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key alarmNamestring No Name of a specific alarm to retrieve history for. Omit for all alarms. historyItemTypestring No Filter by history item type (ConfigurationUpdate, StateUpdate, Action, AlarmContributorStateUpdate, AlarmContributorAction) startDatenumber No Start of the history window as Unix epoch seconds endDatenumber No End of the history window as Unix epoch seconds scanBystring No Sort order: TimestampDescending (newest first) or TimestampAscending limitnumber No Maximum number of history records to return
Parameter Type Description alarmHistoryItemsarray Alarm history items sorted per scanBy, newest first by default ↳ alarmName string Name of the alarm this history item belongs to ↳ alarmType string MetricAlarm or CompositeAlarm ↳ timestamp number Epoch ms when the history item occurred ↳ historyItemType string ConfigurationUpdate, StateUpdate, Action, or contributor variants ↳ historySummary string Human-readable summary of the event
Create a CloudWatch alarm mute rule that suppresses alarms for a fixed duration
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key muteRuleNamestring Yes Unique name for the mute rule (used later to unmute) alarmNamesarray Yes Names of the CloudWatch alarms this mute rule targets durationValuenumber Yes How long the mute lasts (paired with durationUnit) durationUnitstring Yes Unit for durationValue: minutes, hours, or days descriptionstring No Optional description of why the alarms are being muted startDatenumber No When the mute window begins as Unix epoch seconds. Defaults to now (mute starts immediately).
Parameter Type Description successboolean Whether the mute rule was created successfully muteRuleNamestring Name of the mute rule that was created alarmNamesarray Names of the alarms this rule mutes expressionstring Schedule expression used by the mute rule durationstring ISO 8601 duration of the mute window
Delete a CloudWatch alarm mute rule, restoring alarm notifications
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key muteRuleNamestring Yes Name of the mute rule to delete
Parameter Type Description successboolean Whether the mute rule was deleted successfully muteRuleNamestring Name of the mute rule that was deleted