Troubleshooting and Optimization
Which logging approach makes application events easiest to filter by user ID and action in Amazon CloudWatch Logs Insights?
Show the answer
Correct answerB. Write JSON events with consistent field names
AWhy not this: Metrics record measurements rather than detailed application events; user ID dimensions also create high cardinality.
BWhy this is right: CloudWatch Logs Insights can discover JSON fields, making consistent user ID and action fields easy to query.
CWhy not this: Trace annotations support trace filtering but do not provide structured application log records.
DWhy not this: Varying field labels make consistent filtering harder and can require custom parsing.
Structured JSON logs with consistent field names let CloudWatch Logs Insights discover and filter application event fields. Metrics summarize measurements rather than preserve detailed event records.