默认设置很容易,但我无法更改消息的格式。它发送到 CloudWatch
Api Gateway 充当代理
2019-03-15 13:31:22.248 (REQ_ID) 方法完成,状态:200
2019-03-15 13:31:22.248 (REQ_ID) 成功完成执行
2019-03-15 13:31:22.248 (REQ_ID) 方法响应标头:{Cache-Control=max-age=0, private, must-revalidate, Content-Type=application/json; charset=utf-8, Date=Fri, 2019 年 3 月 15 日 13:31:22 GMT, ETag=W/"607046c7bacdeee5e27e99f48fa2e053", Server=nginx/1.12.1 + Phusion Passenger 4.0.60, Status=200 OK, Vary=Accept -编码,来源,X-Content-Type-Options=nosniff,X-Frame-Options=SAMEORIGIN,X-Powered-By=Phusion Passenger 4.0.60,X-Request-Id=88c8f3c2-0a25-4445-9010-30d4753b855a , X-Runtime=0.030736, X-XSS-Protection=1; 模式=块,连接=保持活动}
2019-03-15 13:31:22.248 (REQ_ID) 转换后的方法响应正文:{"success":1,"message":"Token is invalid"}
2019-03-15 13:31:22.248 (REQ_ID) 端点响应标头:{Cache-Control=max-age=0, private, must-revalidate, Content-Type=application/json; charset=utf-8, Date=Fri, 2019 年 3 月 15 日 13:31:22 GMT, ETag=W/"607046c7bacdeee5e27e99f48fa2e053", Server=nginx/1.12.1 + Phusion Passenger 4.0.60, Status=200 OK, Vary=Accept -编码,来源,X-Content-Type-Options=nosniff,X-Frame-Options=SAMEORIGIN,X-Powered-By=Phusion Passenger 4.0.60,X-Request-Id=88c8f3c2-0a25-4445-9010-30d4753b855a , X-Runtime=0.030736, X-XSS-Protection=1; 模式=块,传输编码=分块,连接=保持活动}
2019-03-15 13:31:22.248 (REQ_ID) 转换前的端点响应正文:{"success":1,"message":"Token is invalid"}
2019-03-15 13:31:22.248 (REQ_ID) 收到响应。集成延迟:43 毫秒
2019-03-15 13:31:22.205 (REQ_ID) 向https://proxy.domain.com/api/endpoint发送请求
2019-03-15 13:31:22.205 (REQ_ID) 转换后的端点请求正文:{"message":"hello world"}
2019-03-15 13:31:22.205 (REQ_ID) 端点请求标头:{x-amzn-apigateway-api-id=API, User-Agent=curl/7.54.0, X-Forwarded-Proto=https, X- Forwarded-For=195.24.159.254,content-type=application/json,X-Forwarded-Port=443,X-Amzn-Trace-Id=Root=1-5c8ba92a-7fb7fa94b9991bb8f1561d55,accept= / }
2019-03-15 13:31:22.205 (REQ_ID) 端点请求 URI: https ://proxy.domain.com/api/endpoint
2019-03-15 13:31:22.119 (REQ_ID) 转换前的方法请求正文:{"message":"hello world"}
2019-03-15 13:31:22.119 (9f76246a-4726-11e9-a18d-25bda2ff1f7b) 方法请求标头:{User-Agent=curl/7.54.0, X-Forwarded-Proto=https, X-Forwarded-For= 195.24.159.254,content-type=application/json,Host=api.execute-api.eu-west-1.amazonaws.com,X-Forwarded-Port=443,X-Amzn-Trace-Id=Root=1- 5c8ba92a-7fb7fa94b9991bb8f1561d55,接受= / }
2019-03-15 13:31:22.119 (REQ_ID) 方法请求查询字符串:{}
2019-03-15 13:31:22.119 (REQ_ID) 方法请求路径:{proxy=api/endpoint}
我只需要在 JSON 中发送这 4 列:request_header、request_body、response_header、response_body 到 ES。现在它为每个请求发送上面的所有日志。