如何在 CloudWatch Logs 中尋找 API Gateway 的 5xx 錯誤?

1 分的閱讀內容
0

我不斷在 Amazon API Gateway CloudWatch 指標中看到 5xx 錯誤。如何在 Amazon CloudWatch Logs 中尋找 API Gateway 的特定 5xx 錯誤?

解決方案

**注意:**如果您在執行 AWS Command Line Interface (AWS CLI) 命令時收到錯誤訊息,請確保您使用的是最新的 AWS CLI 版本

API Gateway CloudWatch 指標顯示指定期間內擷取的 5xx 伺服器端錯誤數目。若要識別 API Gateway 的特定 5xx 錯誤,請執行以下動作:

  1. 在 Amazon CloudWatch Logs 中啟用執行日誌記錄和存取日誌記錄
  2. 使用 filter-log-events AWS CLI 命令或 CloudWatch Logs Insights,尋找 API Gateway 的特定 5xx 錯誤。

**注意:**如果您要疑難排解 API Gateway 的 504 錯誤,請參閱如何對 API Gateway REST API 的 HTTP 504 錯誤進行疑難排解?

如需如何使用 filter-log-events 命令的相關資訊,請參閱如何在 CloudWatch Logs 中尋找 API Gateway REST API 錯誤?如需如何使用 CloudWatch Logs Insights 的相關資訊,請參閱使用 CloudWatch Logs Insights 分析日誌資料


相關資訊

使用 API Gateway 主控台設定 CloudWatch API 日誌記錄

在 CloudWatch 主控台中檢視 API Gateway 日誌事件

AWS 官方
AWS 官方已更新 3 年前