ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

概念 · 基于 SAA-C03

Logs and tracing to troubleshoot ML systems

Read the signal first: logs for container errors, traces for slow hops, CloudTrail for denied or failed API calls.

本课尚未翻译,暂以英文显示。

你在Solutions Architect Associate中已学过

  • X-Ray traces a request through services and draws a trace map.
  • It samples requests and shows which part is slow or failing.
  • Lambda and API Gateway can send traces when tracing is on.
阅读Solutions Architect Associate课程
Client
API Gateway
Lambda
SageMaker endpoint
X-Ray trace
Container logs
Traces cover the hops, logs cover the inside of the container.
  • Training job failed

    FailureReason and job logs
  • Endpoint returns 5XX

    Container logs, then metrics
  • Whole request is slow

    X-Ray trace map
  • AccessDenied or validation error

    CloudTrail event
  • Out-of-memory suspicion

    Memory metric and logs
Symptom to signal.

是什么

SageMaker AI sends container output to CloudWatch Logs: stdout and stderr from training jobs go to /aws/sagemaker/TrainingJobs, endpoints to /aws/sagemaker/Endpoints/your-endpoint-name, and processing jobs to /aws/sagemaker/ProcessingJobs. When a training job fails, the job description shows a FailureReason, such as AlgorithmError for a problem in the training code or ClientError for a configuration or permission problem. The log tells you the exact line. Use Logs Insights to search many streams at once, for example all lines with the word Error in the last hour.

是什么

A trace answers a different question: where does the time go across services? In an app where API Gateway calls Lambda and Lambda calls a SageMaker endpoint, X-Ray tracing shows the time spent in each hop, so you see if the endpoint call or the pre-processing code is slow. The endpoint container itself shows up as one call; look in its logs for the inside.

是什么

CloudTrail records API calls and their errors. If a job never starts or a call returns AccessDenied or ValidationException, the CloudTrail event shows who called what and the error message. Read the signal in order: a metric alarm tells you something is wrong, a trace tells you which hop, logs tell you why, and CloudTrail tells you which API call was refused.

要记住

  • Job and container logs go to CloudWatch Logs under /aws/sagemaker/.
  • FailureReason on a training job: AlgorithmError for code, ClientError for setup or permissions.
  • Logs Insights searches across log streams.
  • X-Ray: which hop is slow, such as API Gateway, Lambda or an endpoint call.

要记住

  • CloudTrail: which API call was denied or failed, and why.
  • Order: metric, trace, log, CloudTrail.

考试中

  • “Training job failed, find the line of code” points to the job logs in CloudWatch Logs.
  • “Which service in the chain adds the latency?” points to X-Ray traces.
  • “Who called CreateEndpoint and got AccessDenied?” points to CloudTrail.
  • “Search all endpoint logs for one error string” points to CloudWatch Logs Insights.