![](/img/trans.png)
[英]Cloudformation Parameter map and using !join to join API Gateway uri
[英]API Gateway Access Log using Cloudformation
我需要在 API 网关中启用自定义访问日志记录。 cloudformation写在yaml中。但是对于自定义日志的格式,它是json、xml这样的格式,但没有提到如何在yaml中设置访问日志的格式。有人知道怎么做吗?
在CloudFormation 用户指南中, Format
属性要求您的输入为String
。
DestinationArn: String
Format: String
例如:
DestinationArn: !Sub ${ApiAccessLogGroup.Arn}
Format: "{ 'requestId':'$context.requestId', 'ip': '$context.identity.sourceIp', 'caller':'$context.identity.caller', 'user':'$context.identity.user','requestTime':'$context.requestTime', 'xrayTraceId':'$context.xrayTraceId', 'wafResponseCode':'$context.wafResponseCode', 'httpMethod':'$context.httpMethod','resourcePath':'$context.resourcePath', 'status':'$context.status','protocol':'$context.protocol', 'responseLength':'$context.responseLength' }"
为了简化您的String
或使其看起来更好,请使用!Sub
作为这篇文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.