Skip to content

Commit

Permalink
Use $context.path in HttpApi access logs
Browse files Browse the repository at this point in the history
Replaces $context.route_key, which produces log output like "GET
/unsubscribe/{email}/{uid}". I really want to see those email and uid
values.
  • Loading branch information
mbland committed Apr 10, 2023
1 parent 5043546 commit 258f612
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Resources:
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-stage-accesslogsettings.html
# https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging.html?icmpid=apigateway_console_help
DestinationArn: !GetAtt ApiAccessLogs.Arn
Format: '"$context.identity.sourceIp - - [$context.requestTime] "$context.httpMethod $context.routeKey $context.protocol" $context.status $context.responseLength $context.requestId"'
Format: '"$context.identity.sourceIp - - [$context.requestTime] "$context.httpMethod $context.path $context.protocol" $context.status $context.responseLength $context.requestId"'
DefaultRouteSettings:
# https://stackoverflow.com/a/70423772
# https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html
Expand Down Expand Up @@ -160,7 +160,7 @@ Resources:
Outputs:
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
Api:
Description: "API Gateway root URL for the EListMan function"
Description: "API Gateway root URL for the ListMan function"
Value: !Sub "https://${ApiDomainName}/${ApiMappingKey}"
Function:
Description: "EListMan Lambda function ARN"
Expand Down

0 comments on commit 258f612

Please sign in to comment.