Ross Coundon
03/24/2022, 6:51 PMThomas Ankcorn
03/24/2022, 7:25 PMThomas Ankcorn
03/24/2022, 7:26 PMRoss Coundon
03/24/2022, 7:29 PMGabriel Araújo
03/24/2022, 7:39 PMGabriel Araújo
03/24/2022, 7:40 PMRoss Coundon
03/24/2022, 7:45 PMRoss Coundon
03/24/2022, 7:52 PMaccessLog: true
in the API definition in my stack but the console saysFrank
sst build
, check the CF template in .build/cdk.out
> look for the AWS::ApiGatewayV2::Stage
resourceFrank
AccessLogSettings
inside the Properties
?Ross Coundon
03/24/2022, 8:13 PMRoss Coundon
03/24/2022, 8:13 PM"Stage0E8C2AF5": {
"Type": "AWS::ApiGatewayV2::Stage",
"Properties": {
"ApiId": {
"Ref": "ApiCD79AAA0"
},
"StageName": "cutomer-dev",
"AutoDeploy": true,
},
"Metadata": {
"aws:cdk:path": "somepath/Stage/Resource"
}
}
Frank
Frank
Ross Coundon
03/24/2022, 8:15 PMRoss Coundon
03/24/2022, 8:15 PMhttpApi: {
createDefaultStage: false,
},
Ross Coundon
03/24/2022, 8:15 PMnew HttpStage(this, 'Stage', {
httpApi: api.httpApi,
stageName: this.stage,
autoDeploy: true,
});
Frank
Frank
Frank
import * as logs from "aws-cdk-lib/aws-logs";
const logGroup = new logs.LogGroup(scope, "AccessLog", {
logGroupName: `/aws/vendedlogs/apis/${stage}-${api.httpApi.apiId}`
});
Frank
new HttpStage(this, 'Stage', {
httpApi: api.httpApi,
stageName: this.stage,
autoDeploy: true,
});
Ross Coundon
03/24/2022, 8:21 PMObject literal may only specify known properties, and 'destinationArn' does not exist in type 'HttpStageProps'.
Frank
format
, take this array, and do
const format = "{" + defaultHttpFields.join(",") + "}";
Frank
const apiStage = new HttpStage(this, 'Stage', {
httpApi: api.httpApi,
stageName: this.stage,
autoDeploy: true,
});
apiStage.node.defaultChild.accessLogSettings = { format, destinationArn };
Frank
Duration
and InitDuration
fields)Ross Coundon
03/24/2022, 8:27 PMRoss Coundon
03/24/2022, 8:29 PMFrank
import * as cfnApig from "aws-cdk-lib/aws-apigatewayv2";
const cfnStage = apiStage.node.defaultChild as cfnApig.CfnStage;
cfnStage.accessLogSettings = { format, destinationArn };
Ross Coundon
03/24/2022, 8:30 PMRoss Coundon
03/24/2022, 8:40 PM