Skip to main content

log_anomaly_detectors

Creates, updates, deletes or gets a log_anomaly_detector resource or lists log_anomaly_detectors in a region

Overview

Namelog_anomaly_detectors
TypeResource
DescriptionThe AWS::Logs::LogAnomalyDetector resource specifies a CloudWatch Logs LogAnomalyDetector.
Idawscc.logs.log_anomaly_detectors

Fields

NameDatatypeDescription
account_idstringAccount ID for owner of detector
kms_key_idstringThe Amazon Resource Name (ARN) of the CMK to use when encrypting log data.
detector_namestringName of detector
log_group_arn_listarrayList of Arns for the given log group
evaluation_frequencystringHow often log group is evaluated
filter_patternstring
anomaly_detector_statusstringCurrent status of detector.
anomaly_visibility_timenumber
creation_time_stampnumberWhen detector was created.
last_modified_time_stampnumberWhen detector was lsat modified.
anomaly_detector_arnstringARN of LogAnomalyDetector
regionstringAWS region.

For more information, see AWS::Logs::LogAnomalyDetector.

Methods

NameResourceAccessible byRequired Params
create_resourcelog_anomaly_detectorsINSERT, region
delete_resourcelog_anomaly_detectorsDELETEIdentifier, region
update_resourcelog_anomaly_detectorsUPDATEIdentifier, PatchDocument, region
list_resourceslog_anomaly_detectors_list_onlySELECTregion
get_resourcelog_anomaly_detectorsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual log_anomaly_detector.

SELECT
region,
account_id,
kms_key_id,
detector_name,
log_group_arn_list,
evaluation_frequency,
filter_pattern,
anomaly_detector_status,
anomaly_visibility_time,
creation_time_stamp,
last_modified_time_stamp,
anomaly_detector_arn
FROM awscc.logs.log_anomaly_detectors
WHERE
region = '{{ region }}' AND
Identifier = '{{ anomaly_detector_arn }}';

INSERT example

Use the following StackQL query and manifest file to create a new log_anomaly_detector resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.logs.log_anomaly_detectors (
,
region
)
SELECT
'{{ }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a log_anomaly_detector resource, using stack-deploy.

/*+ update */
UPDATE awscc.logs.log_anomaly_detectors
SET PatchDocument = string('{{ {
"AccountId": account_id,
"KmsKeyId": kms_key_id,
"DetectorName": detector_name,
"LogGroupArnList": log_group_arn_list,
"EvaluationFrequency": evaluation_frequency,
"FilterPattern": filter_pattern,
"AnomalyVisibilityTime": anomaly_visibility_time
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ anomaly_detector_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.logs.log_anomaly_detectors
WHERE
Identifier = '{{ anomaly_detector_arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the log_anomaly_detectors resource, the following permissions are required:

logs:CreateLogAnomalyDetector