Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public bind(scope: Construct, containerDefinition: ContainerDefinition): LogDriverConfig {
this.logGroup = this.props.logGroup || new logs.LogGroup(scope, 'LogGroup', {
retention: this.props.logRetention || Infinity,
});
this.logGroup.grantWrite(containerDefinition.taskDefinition.obtainExecutionRole());
return {
logDriver: 'awslogs',
options: removeEmpty({
'awslogs-group': this.logGroup.logGroupName,
'awslogs-stream-prefix': this.props.streamPrefix,
'awslogs-region': Stack.of(containerDefinition).region,
'awslogs-datetime-format': this.props.datetimeFormat,
'awslogs-multiline-pattern': this.props.multilinePattern,
}),
};
}
addLogGroup(logGroupName: string) {
const retentionDays = Infinity
const props = { logGroupName, retentionDays, retainLogGroup: false }
return new LogGroup(this, `${this.id}-${logGroupName}`, props)
}