LogAnomalyDetector class
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 (let range = 0; range < 2; range++) {
test.push(new aws.cloudwatch.LogGroup(`test-${range}`, {name: `testing-${range}`}));
}
const testLogAnomalyDetector = new aws.cloudwatch.LogAnomalyDetector("test", {
detectorName: "testing",
logGroupArnLists: [test[0].arn],
anomalyVisibilityTime: 7,
evaluationFrequency: "TEN_MIN",
enabled: false,
});
import pulumi
from typing import Any
import pulumi_aws as aws
test: list[aws.cloudwatch.LogGroup] = []
for test_range in [{"value": i} for i in range(0, 2)]:
test.append(aws.cloudwatch.LogGroup(f"test-{test_range['value']}", name=f"testing-{test_range['value']}"))
test_log_anomaly_detector = aws.cloudwatch.LogAnomalyDetector("test",
detector_name="testing",
log_group_arn_lists=[test[0].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/v7/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
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudwatch_loggroup" "test" {
count = 2
name ="testing-${count.index}"
}
resource "aws_cloudwatch_loganomalydetector" "test" {
detector_name = "testing"
log_group_arn_lists = [aws_cloudwatch_loggroup.test[0].arn]
anomaly_visibility_time = 7
evaluation_frequency = "TEN_MIN"
enabled = "false"
}
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.ArrayList;
import java.util.Arrays;
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
Identity Schema
Required
arn(String) ARN of the anomaly detector.
Using pulumi import, import Anomaly Detectors using arn. For example:
$ pulumi import aws:cloudwatch/logAnomalyDetector:LogAnomalyDetector example arn:aws:logs:us-east-1:123456789012:anomaly-detector:1a2b3c4d-5e6f-7890-abcd-ef1234567890
Constructors
- LogAnomalyDetector(String name, {LogAnomalyDetectorArgs? args, CustomResourceOptions? options})
-
Creates a new LogAnomalyDetector.
nameThe Pulumi resource name.argsArguments used to configure this LogAnomalyDetector. The set of arguments for LogAnomalyDetector.optionsResource options controlling this resource's behavior. - LogAnomalyDetector.reference(String urn)
- Creates a typed reference to an existing LogAnomalyDetector resource.
Properties
-
anomalyVisibilityTime
↔ Output<
int> -
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
anomalyVisibilityTime, 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.latefinal -
arn
↔ Output<
String> -
ARN of the log anomaly detector that you just created.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
detectorName
↔ Output<
String?> -
Name for this anomaly detector.
latefinal
-
enabled
↔ Output<
bool> -
latefinal
-
evaluationFrequency
↔ Output<
String?> -
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
evaluationFrequency. Valid Values:ONE_MIN | FIVE_MIN | TEN_MIN | FIFTEEN_MIN | THIRTY_MIN | ONE_HOUR.latefinal -
filterPattern
↔ Output<
String?> -
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.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
kmsKeyId
↔ Output<
String?> -
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.
latefinal
-
logGroupArnLists
↔ Output<
List< String> > -
Array containing the ARN of the log group that this anomaly detector will watch. You can specify only one log group ARN.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
latefinal
-
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {LogAnomalyDetectorState? state, CustomResourceOptions? options}) → LogAnomalyDetector -
Gets an existing LogAnomalyDetector resource's state with the given
nameandid.