Monitoring and Logging

An application writes JSON logs containing numeric bytesProcessed values to CloudWatch Logs. How should a metric filter publish data so the Sum statistic represents total bytes processed?

Show the answer

Correct answerC. Match events containing bytesProcessed and use $.bytesProcessed as the metric value.

AWhy not this: Publishing 1 counts matching log events rather than summing the bytesProcessed values.

BWhy not this: A default value handles periods without matches when logs arrive; it does not extract byte counts from matching events.

CWhy this is right: Extracting $.bytesProcessed publishes each event's byte count, allowing Sum to calculate the total.

DWhy not this: A dimension identifies a metric series; it does not supply the numeric measurement to sum.

A metric filter can extract a numeric JSON field as its metric value; Sum then totals those values. Publishing 1 for each matching event counts events rather than bytes.