logs: logging to cross-account LogGroup does not work
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
# General Issue
Hi. I'm trying to find a way to generate following CloudFormation template using AWS CDK:
```typescript
"helloapiSubscriptionFilter": {
"Type": "AWS::Logs::SubscriptionFilter",
"Properties": {
"DestinationArn": "arn:aws:logs:eu-central-1:xxxxxx:destination:hello-api-stream-destination",
"FilterPattern": "",
"LogGroupName": "/dev/hello-api"
},
}
```
However, it seems that using `CrossAccountDestination` requires mandatory role.
```typescript
logGroup.addSubscriptionFilter(`${awsAppPrefix}-${service.name}SubscriptionFilter`, {
filterPattern: logs.FilterPattern.all(),
// Does not work
destination: new logs.CrossAccountDestination(stack, ``, {
targetArn: service.logDestinationArn,
})
});
```
What would be the optimal way to add this kind of subscription filter properly?
### Environment
- **CDK CLI Version: 1.30.0**
- **Module Version: 1.30.0**
- **OS: Macbook**
- **Language: TypeScript**
### Other information
Contributor guide
Research direction
Start by examining the TypeScript implementations of CrossAccountDestination and addSubscriptionFilter, then compare their synthesized CloudFormation with the template in the issue. Determine how the destination ARN and role are handled for cross-account subscriptions; done means the requested AWS::Logs::SubscriptionFilter can be synthesized without an unnecessary mandatory role.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100