Skip to content

update_log_anomaly_detector async

update_log_anomaly_detector(
    anomaly_detector_arn: AnomalyDetectorArn,
    enabled: Boolean,
    *,
    config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
    evaluation_frequency: Optional[EvaluationFrequency] = None,
    filter_pattern: Optional[FilterPattern] = None,
    anomaly_visibility_time: Optional[AnomalyVisibilityTime] = None,
) -> None

Updates an existing log anomaly detector.

Parameters:

  • anomaly_detector_arn (AnomalyDetectorArn) –

    The ARN of the anomaly detector that you want to update.

  • evaluation_frequency (Optional[EvaluationFrequency], default: None ) –

    Specifies how often the anomaly detector runs and look for anomalies. Set this value according to the frequency that the log group receives new logs. For example, if the log group receives new log events every 10 minutes, then setting evaluationFrequency to FIFTEEN_MIN might be appropriate.

  • anomaly_visibility_time (Optional[AnomalyVisibilityTime], default: None ) –

    The number of days to use as the life cycle of anomalies. After this time, anomalies are automatically baselined and the anomaly detector model will treat new occurrences of similar event as normal. Therefore, if you do not correct the cause of an anomaly during this time, it will be considered normal going forward and will not be detected.

  • enabled (Boolean) –

    Use this parameter to pause or restart the anomaly detector.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
async def update_log_anomaly_detector(
    self,
    anomaly_detector_arn: "capo_cloudwatch_logs.types.anomaly_detector_arn.AnomalyDetectorArn",
    enabled: "capo_cloudwatch_logs.types.boolean.Boolean",
    *,
    config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
    evaluation_frequency: Optional[
        "capo_cloudwatch_logs.types.evaluation_frequency.EvaluationFrequency"
    ] = None,
    filter_pattern: Optional[
        "capo_cloudwatch_logs.types.filter_pattern.FilterPattern"
    ] = None,
    anomaly_visibility_time: Optional[
        "capo_cloudwatch_logs.types.anomaly_visibility_time.AnomalyVisibilityTime"
    ] = None,
) -> None:
    """<p>Updates an existing log anomaly detector.</p>

    Args:
        anomaly_detector_arn: <p>The ARN of the anomaly detector that you want to update.</p>
        evaluation_frequency: <p>Specifies how often the anomaly detector runs and look for anomalies. Set this value according to the frequency that the log group receives new logs. For example, if the log group receives new log events every 10 minutes, then setting <code>evaluationFrequency</code> to <code>FIFTEEN_MIN</code> might be appropriate.</p>
        anomaly_visibility_time: <p>The number of days to use as the life cycle of anomalies. After this time, anomalies are automatically baselined and the anomaly detector model will treat new occurrences of similar event as normal. Therefore, if you do not correct the cause of an anomaly during this time, it will be considered normal going forward and will not be detected.</p>
        enabled: <p>Use this parameter to pause or restart the anomaly detector. </p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.operation_aborted_exception.OperationAbortedException: <p>Multiple concurrent requests to update the same resource were in conflict.</p>
        capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatch_logs.types.update_log_anomaly_detector_request.UpdateLogAnomalyDetectorRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_cloudwatch_logs._operations.logs_20140328.update_log_anomaly_detector

        (
            output,
            http_response,
        ) = await capo_cloudwatch_logs._operations.logs_20140328.update_log_anomaly_detector.async_update_log_anomaly_detector(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateLogAnomalyDetector")
    )
    input_: capo_cloudwatch_logs.types.update_log_anomaly_detector_request.UpdateLogAnomalyDetectorRequest = {
        "anomaly_detector_arn": anomaly_detector_arn,
        "enabled": enabled,
    }
    if evaluation_frequency is not None:
        input_["evaluation_frequency"] = evaluation_frequency
    if filter_pattern is not None:
        input_["filter_pattern"] = filter_pattern
    if anomaly_visibility_time is not None:
        input_["anomaly_visibility_time"] = anomaly_visibility_time

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output