-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaccessLogFormat.ts
More file actions
38 lines (37 loc) · 1.41 KB
/
accessLogFormat.ts
File metadata and controls
38 lines (37 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {AccessLogFormat} from "aws-cdk-lib/aws-apigateway"
export const accessLogFormat = () => {
return AccessLogFormat.custom(JSON.stringify({
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",
accountId: "$context.accountId",
apiId: "$context.apiId",
stage: "$context.stage",
api_key: "$context.identity.apiKey",
identity: {
sourceIp: "$context.identity.sourceIp",
userAgent: "$context.identity.userAgent",
clientCert: {
subjectDN: "$context.identity.clientCert.subjectDN",
issuerDN: "$context.identity.clientCert.issuerDN",
serialNumber: "$context.identity.clientCert.serialNumber",
validityNotBefore: "$context.identity.clientCert.validity.notBefore",
validityNotAfter: "$context.identity.clientCert.validity.notAfter"
}
},
integration:{
error: "$context.integration.error",
integrationStatus: "$context.integration.integrationStatus",
latency: "$context.integration.latency",
requestId: "$context.integration.requestId",
status: "$context.integration.status"
}
}))
}