Skip to content
v2.278.0

Experimental

@aws-cdk/aws-pipes-targets-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

CloudWatchLogsTargetParameters Struct ​

CloudWatch Logs target properties.

Example ​

ts
declare const sourceQueue: sqs.Queue;
declare const targetLogGroup: logs.LogGroup;

const logGroupTarget = new targets.CloudWatchLogsTarget(targetLogGroup, {
  inputTransformation: pipes.InputTransformation.fromObject({ body: "👀" }),
});

const pipe = new pipes.Pipe(this, 'Pipe', {
    source: new SqsSource(sourceQueue),
    target: logGroupTarget,
});
python
# source_queue: sqs.Queue
# target_log_group: logs.LogGroup


log_group_target = targets.CloudWatchLogsTarget(target_log_group,
    input_transformation=pipes.InputTransformation.from_object({"body": "👀"})
)

pipe = pipes.Pipe(self, "Pipe",
    source=SqsSource(source_queue),
    target=log_group_target
)
java
Queue sourceQueue;
LogGroup targetLogGroup;


CloudWatchLogsTarget logGroupTarget = CloudWatchLogsTarget.Builder.create(targetLogGroup)
        .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀")))
        .build();

Pipe pipe = Pipe.Builder.create(this, "Pipe")
        .source(new SqsSource(sourceQueue))
        .target(logGroupTarget)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Targets.Alpha
Queue sourceQueue;
LogGroup targetLogGroup;


var logGroupTarget = new CloudWatchLogsTarget(targetLogGroup, new CloudWatchLogsTargetParameters {
    InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "👀" } })
});

var pipe = new Pipe(this, "Pipe", new PipeProps {
    Source = new SqsSource(sourceQueue),
    Target = logGroupTarget
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipestargetsalpha/v2
var sourceQueue Queue
var targetLogGroup LogGroup


logGroupTarget := targets.NewCloudWatchLogsTarget(targetLogGroup, &CloudWatchLogsTargetParameters{
	InputTransformation: pipes.InputTransformation_FromObject(map[string]interface{}{
		"body": jsii.String("👀"),
	}),
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: awscdkpipessourcesalpha.NewSqsSource(sourceQueue),
	Target: logGroupTarget,
})

Properties ​

inputTransformationoptionalIInputTransformationinput_transformationoptionalIInputTransformationinputTransformationoptionalIInputTransformationInputTransformationoptionalIInputTransformationInputTransformationoptionalIInputTransformation = none #
The input transformation to apply to the message before sending it to the target.
logStreamNameoptionalstringlog_stream_nameoptionalstrlogStreamNameoptionalStringLogStreamNameoptionalstringLogStreamNameoptional*string = none #
The name of the log stream.
timestampoptionalstringtimestampoptionalstrtimestampoptionalStringTimestampoptionalstringTimestampoptional*string #
The JSON path expression that references the timestamp in the payload.

Default: current time

This is the time that the event occurred, as a JSON path expression in the payload.

example
ts
'$.data.timestamp'