Concept · Builds on 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.
You know from 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.
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 | Look at |
|---|---|
| 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 |
What it is
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.
What it is
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.
What it is
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.
Remember
- 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.
Remember
- CloudTrail: which API call was denied or failed, and why.
- Order: metric, trace, log, CloudTrail.
On the exam
- “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.
Do not mix it up with
- CloudWatch metrics and dashboards for MLKnow which endpoint and training metrics exist, where they live, and how to turn them into dashboards and alarms.
- Troubleshooting ML security issuesWork out whether a failure is a permission or a network path, then read the error and the CloudTrail event.
- Agent monitoring and AgentCore ObservabilityTraces show each reasoning step and tool call, so you can find loops, failing tools and handoffs that went wrong.
In this task · 4.2
- Inference instance families
- Inference Recommender and right-sizing
- CloudWatch metrics and dashboards for ML
- Logs and tracing to troubleshoot ML systems
- Capacity, quotas and throttling
- Cost tools, tags and spending limits
- Purchasing options for ML infrastructure
- FM inference costs and token monitoring
- Reducing FM usage cost