class Transformer (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Logs.Transformer |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#Transformer |
![]() | software.amazon.awscdk.services.logs.Transformer |
![]() | aws_cdk.aws_logs.Transformer |
![]() | aws-cdk-lib » aws_logs » Transformer |
Implements
IConstruct
, IDependable
, IResource
Represent the L2 construct for the AWS::Logs::Transformer CloudFormation resource.
Example
// Create a log group
const logGroup = new logs.LogGroup(this, 'MyLogGroup');
// Create a JSON parser processor
const jsonParser = new logs.ParserProcessor({
type: logs.ParserProcessorType.JSON
});
// Create a processor to add keys
const addKeysProcessor = new logs.JsonMutatorProcessor({
type: logs.JsonMutatorType.ADD_KEYS,
addKeysOptions: {
entries: [{
key: 'metadata.transformed_in',
value: 'CloudWatchLogs'
}]
}
});
// Create a transformer with these processors
new logs.Transformer(this, 'Transformer', {
transformerName: 'MyTransformer',
logGroup: logGroup,
transformerConfig: [jsonParser, addKeysProcessor]
});
Initializer
new Transformer(scope: Construct, id: string, props: TransformerProps)
Parameters
- scope
Construct
- id
string
- props
Transformer
Props
The Transformer L2 construct that represents AWS::Logs::Transformer CFN resource.
Construct Props
Name | Type | Description |
---|---|---|
log | ILog | Existing log group that you want to associate with this transformer. |
transformer | IProcessor [] | List of processors in a transformer. |
transformer | string | Name of the transformer. |
logGroup
Type:
ILog
Existing log group that you want to associate with this transformer.
transformerConfig
Type:
IProcessor
[]
List of processors in a transformer.
transformerName
Type:
string
Name of the transformer.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
static PROPERTY_INJECTION_ID | string | The property injection ID for this resource class. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
static PROPERTY_INJECTION_ID
Type:
string
The property injection ID for this resource class.
Used by the CDK frameworks for managing resource lifecycle.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.