What are CloudWatch Logs and Logs Insights?
BeginnerConceptKubernetes Monitoring, Scale & Cloud
Answer
CloudWatch Logs stores logs in log groups (per app or service) made of log streams (per instance, container or Lambda execution environment). Retention is set per log group (default is never expire, a common cost trap).
Logs Insights is the query language:
fields @timestamp, @message, @logStream
| filter @message like /ERROR/
| stats count(*) as errors by bin(5m)
| sort errors desc
Other features: metric filters (turn a log pattern into a CloudWatch metric you can alarm on), subscription filters (stream to Lambda, Kinesis or Firehose for shipping to another backend) and the Infrequent Access log class for cheaper storage of rarely queried logs.
aws logs put-retention-policy --log-group-name /app/api --retention-in-days 30
More on Kubernetes Monitoring, Scale & Cloud
What is kube-prometheus-stack and what does it install?BeginnerWhat CRDs does the Prometheus Operator provide?IntermediateHow does the Prometheus Operator decide which ServiceMonitors to load?IntermediateWhich cAdvisor container memory metric should you watch, and why?IntermediateHow do metrics-server and the custom/external metrics APIs relate to HPA?IntermediateWhich kube-state-metrics metrics do you use most?Beginner