LogAnomalyDetectorArgs

data class LogAnomalyDetectorArgs(val anomalyVisibilityTime: Output<Int>? = null, val detectorName: Output<String>? = null, val enabled: Output<Boolean>? = null, val evaluationFrequency: Output<String>? = null, val filterPattern: Output<String>? = null, val kmsKeyId: Output<String>? = null, val logGroupArnLists: Output<List<String>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<LogAnomalyDetectorArgs>

Resource for managing an AWS CloudWatch Logs Log Anomaly Detector.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test: aws.cloudwatch.LogGroup[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
test.push(new aws.cloudwatch.LogGroup(`test-${range.value}`, {name: `testing-${range.value}`}));
}
const testLogAnomalyDetector = new aws.cloudwatch.LogAnomalyDetector("test", {
detectorName: "testing",
logGroupArnLists: [test[0]&#46;arn],
anomalyVisibilityTime: 7,
evaluationFrequency: "TEN_MIN",
enabled: false,
});
import pulumi
import pulumi_aws as aws
test = []
for range in [{"value": i} for i in range(0, 2)]:
test.append(aws.cloudwatch.LogGroup(f"test-{range['value']}", name=f"testing-{range['value']}"))
test_log_anomaly_detector = aws.cloudwatch.LogAnomalyDetector("test",
detector_name="testing",
log_group_arn_lists=[test[0]&#46;arn],
anomaly_visibility_time=7,
evaluation_frequency="TEN_MIN",
enabled=False)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new List<Aws.CloudWatch.LogGroup>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
test.Add(new Aws.CloudWatch.LogGroup($"test-{range.Value}", new()
{
Name = $"testing-{range.Value}",
}));
}
var testLogAnomalyDetector = new Aws.CloudWatch.LogAnomalyDetector("test", new()
{
DetectorName = "testing",
LogGroupArnLists = new[]
{
test[0].Arn,
},
AnomalyVisibilityTime = 7,
EvaluationFrequency = "TEN_MIN",
Enabled = false,
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
var test []*cloudwatch.LogGroup
for index := 0; index < 2; index++ {
key0 := index
val0 := index
__res, err := cloudwatch.NewLogGroup(ctx, fmt.Sprintf("test-%v", key0), &cloudwatch.LogGroupArgs{
Name: pulumi.Sprintf("testing-%v", val0),
})
if err != nil {
return err
}
test = append(test, __res)
}
_, err = cloudwatch.NewLogAnomalyDetector(ctx, "test", &cloudwatch.LogAnomalyDetectorArgs{
DetectorName: pulumi.String("testing"),
LogGroupArnLists: pulumi.StringArray{
test[0].Arn,
},
AnomalyVisibilityTime: pulumi.Int(7),
EvaluationFrequency: pulumi.String("TEN_MIN"),
Enabled: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.LogGroup;
import com.pulumi.aws.cloudwatch.LogGroupArgs;
import com.pulumi.aws.cloudwatch.LogAnomalyDetector;
import com.pulumi.aws.cloudwatch.LogAnomalyDetectorArgs;
import com.pulumi.codegen.internal.KeyedValue;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
for (var i = 0; i < 2; i++) {
new LogGroup("test-" + i, LogGroupArgs.builder()
.name(String.format("testing-%s", range.value()))
.build());
}
var testLogAnomalyDetector = new LogAnomalyDetector("testLogAnomalyDetector", LogAnomalyDetectorArgs.builder()
.detectorName("testing")
.logGroupArnLists(test[0].arn())
.anomalyVisibilityTime(7)
.evaluationFrequency("TEN_MIN")
.enabled("false")
.build());
}
}
resources:
test:
type: aws:cloudwatch:LogGroup
properties:
name: testing-${range.value}
options: {}
testLogAnomalyDetector:
type: aws:cloudwatch:LogAnomalyDetector
name: test
properties:
detectorName: testing
logGroupArnLists:
- ${test[0].arn}
anomalyVisibilityTime: 7
evaluationFrequency: TEN_MIN
enabled: 'false'

Import

Using pulumi import, import CloudWatch Log Anomaly Detector using the example_id_arg. For example:

$ pulumi import aws:cloudwatch/logAnomalyDetector:LogAnomalyDetector example log_anomaly_detector-arn-12345678

Constructors

Link copied to clipboard
constructor(anomalyVisibilityTime: Output<Int>? = null, detectorName: Output<String>? = null, enabled: Output<Boolean>? = null, evaluationFrequency: Output<String>? = null, filterPattern: Output<String>? = null, kmsKeyId: Output<String>? = null, logGroupArnLists: Output<List<String>>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val anomalyVisibilityTime: Output<Int>? = null

Number of days to have visibility on an anomaly. After this time period has elapsed for an anomaly, it will be automatically baselined and the anomaly detector will treat new occurrences of a similar anomaly as normal. Therefore, if you do not correct the cause of an anomaly during the time period specified in anomaly_visibility_time, it will be considered normal going forward and will not be detected as an anomaly. Valid Range: Minimum value of 7. Maximum value of 90.

Link copied to clipboard
val detectorName: Output<String>? = null

Name for this anomaly detector.

Link copied to clipboard
val enabled: Output<Boolean>? = null
Link copied to clipboard
val evaluationFrequency: Output<String>? = null

Specifies how often the anomaly detector is to run 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 15 minutes might be a good setting for evaluation_frequency. Valid Values: ONE_MIN | FIVE_MIN | TEN_MIN | FIFTEEN_MIN | THIRTY_MIN | ONE_HOUR.

Link copied to clipboard
val filterPattern: Output<String>? = null

You can use this parameter to limit the anomaly detection model to examine only log events that match the pattern you specify here. For more information, see Filter and Pattern Syntax.

Link copied to clipboard
val kmsKeyId: Output<String>? = null

Optionally assigns a AWS KMS key to secure this anomaly detector and its findings. If a key is assigned, the anomalies found and the model used by this detector are encrypted at rest with the key. If a key is assigned to an anomaly detector, a user must have permissions for both this key and for the anomaly detector to retrieve information about the anomalies that it finds.

Link copied to clipboard
val logGroupArnLists: Output<List<String>>? = null

Array containing the ARN of the log group that this anomaly detector will watch. You can specify only one log group ARN. The following arguments are optional:

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Functions

Link copied to clipboard
open override fun toJava(): LogAnomalyDetectorArgs