Observability
This page explains which logs and metrics Hosty keeps, where to find them, and which alarms tell you that something is wrong. Everything is set up by OpenTofu, and most of it is in terraform/modules/cluster/eks.tf, alarms.tf and terraform/modules/hosting/logging.tf.

Logs
Where they are
Source | What | Where | Retention in main.tf |
|---|---|---|---|
Containers | Output of all containers, which is the logs of the applications | CloudWatch, /aws/containerinsights/<cluster>/application | container_insights_log_retention_days |
Pods and nodes | Use of CPU, memory, disk and network, every minute | CloudWatch, /aws/containerinsights/<cluster>/performance | container_insights_log_retention_days |
Nodes | Logs of kubelet and the operating system | CloudWatch, /aws/containerinsights/<cluster>/dataplane and /host | container_insights_log_retention_days |
EKS control plane | The log types in eks_log_types: audit (every request to the API of the cluster) and authenticator by default | CloudWatch, /aws/eks/<cluster>/cluster | eks_log_retention_days |
Aurora | Logs of the database | CloudWatch, /aws/rds/cluster/<cluster>-database/<type> | rds_log_retention_days |
OpenSearch | Application and slow logs, if opensearch_enabled | CloudWatch, /aws/opensearch/<cluster>-search/... | opensearch_log_retention_days of the cluster module |
Client VPN | Connections: who connected, when and from where | CloudWatch, /aws/vpn/<cluster> | vpn_log_retention_days |
Alarms | Logs of the Lambda function that posts alarms to Slack | CloudWatch, /aws/lambda/<cluster>-alarms | alarms_log_retention_days |
Load balancers | Access logs (every request) and connection logs (TLS) of the production, development and internal load balancers | S3, logs.<hosted zone>, under alb-access/, alb-connection/, alb-dev-access/ and alb-dev-connection/ | alb_access_log_retention_days, alb_connection_log_retention_days |
Backup and VPN buckets | Every read and write of an object, recorded by the CloudTrail trail s3_logs | S3, logs.<hosted zone>, under s3/ | s3_log_retention_days |
All of them are kept for 90 days by default. The log groups in CloudWatch are in the region of the cluster, and the bucket logs.<hosted zone> is shared by all clusters.
Changes of AWS resources, that is who changed what in the account, are in the Event history of CloudTrail for 90 days. AWS keeps it for free, without any setup.
Search the logs
Use Logs Insights in CloudWatch. For example, the latest logs of the applications in a namespace:
fields @timestamp, kubernetes.pod_name, kubernetes.container_name, log
| filter kubernetes.namespace_name = "<project>-production"
| sort @timestamp desc
| limit 100Or the use of CPU and memory of the pods of a namespace, from the performance log group:
fields @timestamp, PodName, pod_cpu_utilization, pod_memory_utilization
| filter Type = "Pod" and Namespace = "<project>-production"
| sort @timestamp descTo see live logs of a pod, kubectl logs is quicker. See Basic commands.
Logs of the database
Aurora sends to CloudWatch the logs that the database writes: on MySQL the error, slow query, general and audit logs, and on PostgreSQL the postgresql log. The database writes the error log always, but the slow query, general and audit logs only when they're turned on in the parameter group of the database. Hosty uses the default parameter group, so turn them on there when you need them.
The database also has Performance Insights, with the top queries and the waits of each instance, and Enhanced Monitoring of the operating system every 10 seconds. Open them from the instance in the RDS console.
Metrics
Container Insights
The Amazon CloudWatch Observability add-on runs the CloudWatch agent and Fluent Bit on every node. They collect the logs of containers and the performance of nodes and pods.
Hosty turns off its metric extraction. Container Insights would otherwise publish a separate metric for every pod and container, which costs a few hundred dollars a month, while the alarms need only a few of them. The agent still sends the same data as performance logs, so nothing is lost: query it with Logs Insights. Without the metrics, the Container Insights pages of the CloudWatch console stay empty.
Enhanced observability, Application Signals and X-Ray are turned off too, as Hosty doesn't use them and they're billed separately. The log group /aws/application-signals/data stays only to expire its old data.
Metrics for alarms
Metric filters in alarms.tf turn the performance logs into a few metrics in the namespace Hosty/ContainerInsights: CPU, memory and disk of nodes, CPU and memory of pods, running pods, and errors of the load balancer controller. They have no dimension per node or pod, so the Maximum of a metric is the busiest node or pod at that moment.
AWS services send their own metrics too, at no extra cost:
- Load balancers (AWS/ApplicationELB): requests, response codes and response times, every minute, but only while there are requests.
- Aurora (AWS/RDS): CPU, memory, connections and more, for each instance.
- S3: the size of each bucket, once a day.
Find them in CloudWatch under Metrics.
Alarms
Each cluster has these alarms:
Alarm | Fires when |
|---|---|
Node CPU | The busiest node uses 90% of its CPU or more for 10 minutes. |
Node memory | A node uses 90% of its memory or more for 4 minutes. |
Node filesystem | A disk of a node is 90% full or more for 10 minutes. Kubelet cleans images between 80% and 85%, so this means it can't free enough space. |
Pod CPU | A pod uses 80% of the CPU of its node or more for 4 minutes. |
Pod memory | A pod uses 90% of the memory of its node or more for 4 minutes. |
Missing pods | No running pods are reported in the cluster for 10 minutes, or the agent stopped reporting. |
5xx errors | The applications behind the production load balancer return 100 responses with a 5xx code or more in 10 minutes. |
Load balancer controller | The controller logs errors for an hour in a row, so changes of ingresses don't reach the load balancers. See Troubleshooting. |
Database CPU | An instance of the database uses 85% of its CPU or more for 15 minutes. |
Database memory | An instance of the database has less than 2 GiB of free memory for 15 minutes. If it runs out, the instance restarts. |
The thresholds are high on purpose: the alarms are meant for problems that last, not for short peaks like a deployment. The comments in alarms.tf explain each choice.
Notifications
Alarms send their changes to the SNS topic <cluster>-alarms, which delivers them in two ways. Set both in main.tf:
- Slack: alarms_webhook_url is an incoming webhook of Slack. The Lambda function <cluster>-alarms (terraform/functions/alarms) posts a message when an alarm fires, when it's resolved, when an alarm loses its data while it's firing, and when a new alarm gets its first data. Other changes need no attention and are skipped.
- Email: alarms_email_address gets a message when an alarm fires and when it's back to OK. After the first tofu apply, AWS sends a confirmation link to the address, and nothing arrives until someone clicks it.
Leave either of them empty to turn it off.
Costs
- CloudWatch Logs charges for the data it receives and stores. The audit logs of EKS make up nearly all of the logs of the control plane, about $70 a month. Shorten the retention or drop log types in main.tf to save money.
- Container Insights without metric extraction costs only its logs.
- S3 logs cost only their storage. Load balancers deliver them for free.
- CloudTrail charges for the data events of the backup and VPN buckets ($0.10 per 100,000 events). The trail records only these buckets to keep the cost low.