AptlyStar

CloudWatch

Query and monitor AWS CloudWatch logs, metrics, and alarms

使用说明

Integrate AWS CloudWatch into workflows. 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.

工具

cloudwatch_query_logs

Run a CloudWatch Log Insights query against one or more log groups

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
logGroupNamesarray是Log group names to query
queryStringstring是CloudWatch Log Insights query string
startTimenumber是Start time as Unix epoch seconds
endTimenumber是End time as Unix epoch seconds
limitnumber否Maximum number of results to return

输出

参数类型描述
resultsarrayQuery result rows (each row is a key/value map of field name to value)
statisticsobjectQuery statistics
↳ bytesScannednumberTotal bytes of log data scanned
↳ recordsMatchednumberNumber of log records that matched the query
↳ recordsScannednumberTotal log records scanned
statusstringQuery completion status (Complete, Failed, Cancelled, or Timeout)

cloudwatch_describe_log_groups

List available CloudWatch log groups

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
prefixstring否Filter log groups by name prefix
limitnumber否Maximum number of log groups to return

输出

参数类型描述
logGroupsarrayList of CloudWatch log groups with metadata
↳ logGroupNamestringLog group name
↳ arnstringLog group ARN
↳ storedBytesnumberTotal stored bytes
↳ retentionInDaysnumberRetention period in days (if set)
↳ creationTimenumberCreation time in epoch milliseconds

cloudwatch_get_log_events

Retrieve log events from a specific CloudWatch log stream

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
logGroupNamestring是CloudWatch log group name
logStreamNamestring是CloudWatch log stream name
startTimenumber否Start time as Unix epoch seconds
endTimenumber否End time as Unix epoch seconds
limitnumber否Maximum number of events to return

输出

参数类型描述
eventsarrayLog events with timestamp, message, and ingestion time
↳ timestampnumberEvent timestamp in epoch milliseconds
↳ messagestringLog event message
↳ ingestionTimenumberIngestion time in epoch milliseconds

cloudwatch_describe_log_streams

List log streams within a CloudWatch log group

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
logGroupNamestring是CloudWatch log group name
prefixstring否Filter log streams by name prefix
limitnumber否Maximum number of log streams to return

输出

参数类型描述
logStreamsarrayList of log streams with metadata, sorted by last event time (most recent first) unless a prefix filter is applied
↳ logStreamNamestringLog stream name
↳ lastEventTimestampnumberTimestamp of the last log event in epoch milliseconds
↳ firstEventTimestampnumberTimestamp of the first log event in epoch milliseconds
↳ creationTimenumberStream creation time in epoch milliseconds
↳ storedBytesnumberTotal stored bytes

cloudwatch_list_metrics

List available CloudWatch metrics

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
namespacestring否Filter by namespace (e.g., AWS/EC2, AWS/Lambda)
metricNamestring否Filter by metric name
recentlyActiveboolean否Only show metrics active in the last 3 hours
limitnumber否Maximum number of metrics to return

输出

参数类型描述
metricsarrayList of metrics with namespace, name, and dimensions
↳ namespacestringMetric namespace (e.g., AWS/EC2)
↳ metricNamestringMetric name (e.g., CPUUtilization)
↳ dimensionsarrayArray of name/value dimension pairs

cloudwatch_get_metric_statistics

Get statistics for a CloudWatch metric over a time range

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
namespacestring是Metric namespace (e.g., AWS/EC2, AWS/Lambda)
metricNamestring是Metric name (e.g., CPUUtilization, Invocations)
startTimenumber是Start time as Unix epoch seconds
endTimenumber是End time as Unix epoch seconds
periodnumber是Granularity in seconds (e.g., 60, 300, 3600)
statisticsarray是Statistics to retrieve (Average, Sum, Minimum, Maximum, SampleCount)
dimensionsstring否Dimensions as JSON (e.g., {"InstanceId": "i-1234"})

输出

参数类型描述
labelstringMetric label returned by CloudWatch
datapointsarrayDatapoints sorted by timestamp with statistics values
↳ timestampnumberDatapoint timestamp in epoch milliseconds
↳ averagenumberAverage statistic value
↳ sumnumberSum statistic value
↳ minimumnumberMinimum statistic value
↳ maximumnumberMaximum statistic value
↳ sampleCountnumberSample count statistic value
↳ unitstringUnit of the metric

cloudwatch_put_metric_data

Publish a custom metric data point to CloudWatch

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
namespacestring是Metric namespace (e.g., Custom/MyApp)
metricNamestring是Name of the metric
valuenumber是Metric value to publish
unitstring否Unit of the metric (e.g., Count, Seconds, Bytes)
dimensionsstring否JSON string of dimension name/value pairs

输出

参数类型描述
successbooleanWhether the metric was published successfully
namespacestringMetric namespace
metricNamestringMetric name
valuenumberPublished metric value
unitstringMetric unit
timestampstringTimestamp when the metric was published

cloudwatch_describe_alarms

List and filter CloudWatch alarms

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
alarmNamePrefixstring否Filter alarms by name prefix
stateValuestring否Filter by alarm state (OK, ALARM, INSUFFICIENT_DATA)
alarmTypestring否Filter by alarm type (MetricAlarm, CompositeAlarm)
limitnumber否Maximum number of alarms to return

输出

参数类型描述
alarmsarrayList of CloudWatch alarms with state and configuration
↳ alarmNamestringAlarm name
↳ alarmArnstringAlarm ARN
↳ stateValuestringCurrent state (OK, ALARM, INSUFFICIENT_DATA)
↳ stateReasonstringHuman-readable reason for the state
↳ metricNamestringMetric name (MetricAlarm only)
↳ namespacestringMetric namespace (MetricAlarm only)
↳ thresholdnumberThreshold value (MetricAlarm only)
↳ stateUpdatedTimestampnumberEpoch ms when state last changed

cloudwatch_mute_alarm

Create a CloudWatch alarm mute rule that suppresses alarms for a fixed duration

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
muteRuleNamestring是Unique name for the mute rule (used later to unmute)
alarmNamesarray是Names of the CloudWatch alarms this mute rule targets
durationValuenumber是How long the mute lasts (paired with durationUnit)
durationUnitstring是Unit for durationValue: minutes, hours, or days
descriptionstring否Optional description of why the alarms are being muted
startDatenumber否When the mute window begins as Unix epoch seconds. Defaults to now (mute starts immediately).

输出

参数类型描述
successbooleanWhether the mute rule was created successfully
muteRuleNamestringName of the mute rule that was created
alarmNamesarrayNames of the alarms this rule mutes
expressionstringSchedule expression used by the mute rule
durationstringISO 8601 duration of the mute window

cloudwatch_unmute_alarm

Delete a CloudWatch alarm mute rule, restoring alarm notifications

输入

参数类型必填描述
awsRegionstring是AWS region (e.g., us-east-1)
awsAccessKeyIdstring是AWS access key ID
awsSecretAccessKeystring是AWS secret access key
muteRuleNamestring是Name of the mute rule to delete

输出

参数类型描述
successbooleanWhether the mute rule was deleted successfully
muteRuleNamestringName of the mute rule that was deleted

On this page