Black Friday sale: an extra 40% off every course until Monday, November 30.New Year sale: an extra 30% off every course until Friday, January 1.Memorial Day sale: an extra 25% off every course until Monday, May 31.SysAdmin Day sale: an extra 25% off every course until Sunday, August 1.Back to School sale: an extra 25% off every course until Sunday, August 22.Labor Day sale: an extra 25% off every course until Monday, September 6.Black Friday sale: an extra 40% off every course until Monday, November 29.New Year sale: an extra 30% off every course until Saturday, January 1.Choose your certification →

Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

3.2.1.6. Securely Storing & Managing Logs

3.2.1.6. Custom Metrics & Metric Filters (CloudWatch Agent)

Standard AWS metrics cover infrastructure health but not application behavior. Custom metrics fill the gap — tracking business-specific indicators like orders per minute, cart abandonment rate, or API latency percentiles.

Publishing custom metrics:
# CLI: Publish a custom metric
aws cloudwatch put-metric-data \
  --namespace "MyApp/Orders" \
  --metric-name "OrdersProcessed" \
  --value 42 \
  --unit Count \
  --dimensions Environment=Production,Service=OrderAPI

CloudWatch Agent collects OS-level metrics not available by default:

  • Memory utilization, swap usage
  • Disk usage (per-mount), disk I/O
  • Network statistics (TCP connections, packets)
  • Process-level metrics (CPU/memory per process)

Metric filters extract metrics from log data without code changes. Define a pattern that matches log entries, and CloudWatch creates a metric from matches:

# Create metric filter: count ERROR log entries
aws logs put-metric-filter \
  --log-group-name "/prod/app/api" \
  --filter-name "ErrorCount" \
  --filter-pattern '"ERROR"' \
  --metric-transformations \
    metricName=ApplicationErrors,metricNamespace=MyApp,metricValue=1
Metric filter patterns:
  • Simple text match: "ERROR" matches any log with ERROR
  • JSON pattern: { $.statusCode = 500 } matches structured JSON logs
  • Space-delimited: [ip, user, timestamp, request, status_code = 5*, bytes]

Exam Trap: Metric filters only process log events after the filter is created — they don't backfill historical data. If you create a metric filter for error counting, you'll only see errors from that point forward. To analyze historical logs, use CloudWatch Logs Insights queries instead.

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•26 professional certifications earned