Skip to content

[AWS] [API Gateway] Custom Access Logging support for logs integration #7150

@lucian-ioan

Description

@lucian-ioan

Currently, we support an OOTB integration for API Gateway following the default log format provided by AWS.

Default Log Format

HTTP:

{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","routeKey":"$context.routeKey", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength"}

REST:

{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user","requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","resourcePath":"$context.resourcePath", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength"}

WebSocket:

{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user","requestTime":"$context.requestTime", "eventType":"$context.eventType","routeKey":"$context.routeKey", "status":"$context.status","connectionId":"$context.connectionId"}

Custom Access Logging

We expect users to make use of Custom Access Logging to customize their log output using context variables available for each API type (HTTP, REST, WebSocket).

Following discussions, the additional context variables should be taken into consideration as they provide the most value including filtering via dashboards, mapped as follows:

{"apiId": "$context.apiId", "domainName": "$context.domainName", "stage": "$context.stage"}

To be noted that since users can define their own schemas, we should specify in the integration documentation our recommended schema that works with the integration pipeline (which matches the default variable names and our chosen log names for additional context variables). In case of custom schemas, users should be directed to create custom pipelines.

Future support for additional context variables is expected by demand.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions