log_anomaly_detectors
Creates, updates, deletes or gets a log_anomaly_detector resource or lists log_anomaly_detectors in a region
Overview
| Name | log_anomaly_detectors |
| Type | Resource |
| Description | The AWS::Logs::LogAnomalyDetector resource specifies a CloudWatch Logs LogAnomalyDetector. |
| Id | awscc.logs.log_anomaly_detectors |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
account_id | string | Account ID for owner of detector |
kms_key_id | string | The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. |
detector_name | string | Name of detector |
log_group_arn_list | array | List of Arns for the given log group |
evaluation_frequency | string | How often log group is evaluated |
filter_pattern | string | |
anomaly_detector_status | string | Current status of detector. |
anomaly_visibility_time | number | |
creation_time_stamp | number | When detector was created. |
last_modified_time_stamp | number | When detector was lsat modified. |
anomaly_detector_arn | string | ARN of LogAnomalyDetector |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
anomaly_detector_arn | string | ARN of LogAnomalyDetector |
region | string | AWS region. |
For more information, see AWS::Logs::LogAnomalyDetector.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | log_anomaly_detectors | INSERT | , region |
delete_resource | log_anomaly_detectors | DELETE | Identifier, region |
update_resource | log_anomaly_detectors | UPDATE | Identifier, PatchDocument, region |
list_resources | log_anomaly_detectors_list_only | SELECT | region |
get_resource | log_anomaly_detectors | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = 'us-east-1' AND
Identifier = '{{ anomaly_detector_arn }}';
Lists all log_anomaly_detectors in a region.
SELECT
region,
anomaly_detector_arn
FROM awscc.logs.log_anomaly_detectors_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new log_anomaly_detector resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.logs.log_anomaly_detectors (
,
region
)
SELECT
'{{ }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.logs.log_anomaly_detectors (
AccountId,
KmsKeyId,
DetectorName,
LogGroupArnList,
EvaluationFrequency,
FilterPattern,
AnomalyVisibilityTime,
region
)
SELECT
'{{ account_id }}',
'{{ kms_key_id }}',
'{{ detector_name }}',
'{{ log_group_arn_list }}',
'{{ evaluation_frequency }}',
'{{ filter_pattern }}',
'{{ anomaly_visibility_time }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: log_anomaly_detector
props:
- name: account_id
value: '{{ account_id }}'
- name: kms_key_id
value: '{{ kms_key_id }}'
- name: detector_name
value: '{{ detector_name }}'
- name: log_group_arn_list
value:
- '{{ log_group_arn_list[0] }}'
- name: evaluation_frequency
value: '{{ evaluation_frequency }}'
- name: filter_pattern
value: '{{ filter_pattern }}'
- name: anomaly_visibility_time
value: null
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.logs.log_anomaly_detectors
WHERE
Identifier = '{{ anomaly_detector_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the log_anomaly_detectors resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
logs:CreateLogAnomalyDetector
logs:GetLogAnomalyDetector
logs:UpdateLogAnomalyDetector
logs:DeleteLogAnomalyDetector
logs:ListLogAnomalyDetectors