Describe the bug
I want to set up custom log format for API Gateway:
new RestApi(this, "myapi", {
deployOptions: {
accessLogFormat: AccessLogFormat.custom(JSON.stringify({
accountId: AccessLogField.contextAccountId(),
...
})
})
Expected Behavior
According to the definition of AccessLogField.contextAccountId() this should return The API owner's AWS account ID. After synthesizing the template, this should then get translated to $context.accountId.
Current Behavior
AccessLogField.contextAccountId() gets translated to $context.identity.accountId which would return the account ID of the caller.
Reproduction Steps
Setup a RestApi with custom log format and use AccessLogField.contextAccountId().
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.38.1 (build a5ced21)
Framework Version
No response
Node.js Version
v16.17.0
OS
macOS
Language
Typescript
Language Version
No response
Other information
No response
Describe the bug
I want to set up custom log format for API Gateway:
Expected Behavior
According to the definition of
AccessLogField.contextAccountId()this should returnThe API owner's AWS account ID.After synthesizing the template, this should then get translated to$context.accountId.Current Behavior
AccessLogField.contextAccountId()gets translated to$context.identity.accountIdwhich would return the account ID of the caller.Reproduction Steps
Setup a
RestApiwith custom log format and useAccessLogField.contextAccountId().Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.38.1 (build a5ced21)
Framework Version
No response
Node.js Version
v16.17.0
OS
macOS
Language
Typescript
Language Version
No response
Other information
No response