list_anomalies
¶
list_anomalies(
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = None,
time_range: Optional[IntelligenceTimeRange] = None,
services: Optional[IntelligenceServiceNameList] = None,
signal_types: Optional[AnomalySignalTypeList] = None,
max_results: Optional[int] = None,
next_token: Optional[PaginationToken] = None,
severity: Optional[Severity] = None,
source_account_id: Optional[SourceAccountIdList] = None,
anomaly_ids: Optional[AnomalyIdList] = None,
) -> ListAnomaliesOutput
This operation is part of Observations, which is in preview release for Amazon CloudWatch Omni and is subject to change. Retrieves the anomalies matching the given filters.
Parameters:
-
time_range(Optional[IntelligenceTimeRange], default:None) –Time window to scope the anomaly search.
-
services(Optional[IntelligenceServiceNameList], default:None) –Filter by service names.
-
signal_types(Optional[AnomalySignalTypeList], default:None) –Filter by signal types (e.g. logs, metrics, traces).
-
max_results(Optional[int], default:None) –Maximum number of anomalies to return per page.
-
next_token(Optional[PaginationToken], default:None) –Pagination token from a previous response.
-
severity(Optional[Severity], default:None) –Filter by severity level. Anomaly severities are lowercase, so send "high", not "HIGH". One level only; there is no severity list and no minimum-severity filter.
-
source_account_id(Optional[SourceAccountIdList], default:None) –Filter by the accounts that produced the signal.
-
anomaly_ids(Optional[AnomalyIdList], default:None) –Optional batch-get filter. When set, anomalies are fetched by ID under the caller's account. Pagination still applies: maxResults bounds the returned anomalies per page; nextToken cursors through the input ID list. An ID that does not exist, or that the caller is not permitted to read, is omitted from items; compare the IDs you requested against the IDs returned across all pages to find them. anomalyIds is mutually exclusive with the other filters (timeRange, services, signalTypes, severity, sourceAccountId) — passing any of them alongside anomalyIds returns a ValidationException. Use a follow-up ListAnomalies call without anomalyIds for filtered queries.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
List high-severity log anomalies for a service The following example lists the high-severity anomalies detected in the logs of one service over a one-hour window. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.list_anomalies(time_range={'start': '2026-09-16T00:00:00Z', 'end': '2026-09-16T01:00:00Z'}, services=['checkout-service'], signal_types=['logs'], severity='high', max_results=25)
Retrieve anomalies by ID
The following example retrieves two anomalies by their IDs, for example the anomalies an observation correlates. An ID that does not exist or that the caller cannot read is left out of the response. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.list_anomalies(anomaly_ids=['3f6c1a4b8e0d2f5a7c9e1b3d5f7a9c0e2b4d6f8a0c2e4a6b8d0f2a4c6e8b0d2f', '7b2e4d6f8a0c1e3a5c7e9b1d3f5a7c9e0b2d4f6a8c0e2a4c6e8b0d2f4a6c8e0b'])
Read what accounted for a trace anomaly
The following example lists trace anomalies for a service. Each occurrence states what it measured and what accounted for the anomalous excess. The error rate carries no statistic because nothing aggregated it in CloudWatch's sense — it is a ratio the detector derived from counts. The shares have different bases and must not be summed across dimensions: a tool share is a share of the anomalous excess, while an error-class share is a share of the total failures. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.list_anomalies(time_range={'start': '2026-09-16T00:00:00Z', 'end': '2026-09-16T01:00:00Z'}, services=['payments-service'], signal_types=['traces'], max_results=25)
Read a metric anomaly, including one that measures no figure
The following example lists metric anomalies. The first states the figure it compared, in the unit CloudWatch published the metric as; a metric occurrence carries no quantity, because the anomaly already names the metric. The second is a presence anomaly: it measures nothing, so it carries no measurement at all, and what it found is in signalDetails instead. Both still state the window their findings cover. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.list_anomalies(time_range={'start': '2026-09-16T00:00:00Z', 'end': '2026-09-16T01:00:00Z'}, signal_types=['metrics'], max_results=25)
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 | |