Support Fluentbit to CloudWatch logs (#140)

* Import and customize fluenbit add-on

* Enable fluent bit logs

* Bump helm addon version

* Dropping account id as it seems to create scraping errors

* Create separate log groups per namespace

* Apply pre-commit

* Remove conflicting global label

* Add config object for logs

* Enable logs in examples

* Add logs docs

* Fix broken link

* Add screenshots

* Update docs

* Typos
This commit is contained in:
Rodrigue Koffi
2023-03-30 15:48:40 +02:00
committed by GitHub
parent c358008f92
commit 4019db6cd7
20 changed files with 386 additions and 36 deletions
+3 -1
View File
@@ -123,4 +123,6 @@ classDiagram
## Getting started with AWS Observability services
If you are new to AWS Observability services, or want to dive deeper into them, check our [One Observability Workshop](https://catalog.workshops.aws/observability/) for a hands-on experience in a self-paced environement or at an AWS venue.
If you are new to AWS Observability services, or want to dive deeper into them,
check our [One Observability Workshop](https://catalog.workshops.aws/observability/)
for a hands-on experience in a self-paced environement or at an AWS venue.
+67
View File
@@ -0,0 +1,67 @@
# Viewing Logs
By default, we deploy a FluentBit daemon set in the cluster to collect worker
logs for all namespaces. Logs collection can be disabled with
`enable_logs = false`. Logs are collected and exported to Amazon CloudWatch Logs,
which enables you to centralize the logs from all of your systems, applications,
and AWS services that you use, in a single, highly scalable service.
Further configuration options are available in the [module documentation](https://github.com/aws-observability/terraform-aws-observability-accelerator/tree/main/modules/eks-monitoring#inputs).
This guide shows how you can leverage CloudWatch Logs in Amazon Managed Grafana
for your cluster and application logs.
## Using CloudWatch Logs as data source in Grafana
Follow [the documentation](https://docs.aws.amazon.com/grafana/latest/userguide/using-amazon-cloudwatch-in-AMG.html)
to enable Amazon CloudWatch as a data source. Make sure to provide permissions.
!!! tip
If you created your workspace with our [provided example](https://aws-observability.github.io/terraform-aws-observability-accelerator/helpers/managed-grafana/),
Amazon CloudWatch data source has already been setup for you.
All logs are delivered in the following CloudWatch Log groups naming pattern:
`/aws/eks/observability-accelerator/{cluster-name}/{namespace}`. Log streams
follow `{container-name}.{pod-name}`. In Grafana, querying and analyzing logs
is done with [CloudWatch Logs Insights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html)
### Example - ADOT collector logs
Select one or many log groups and run the following query. The example below,
queries AWS Distro for OpenTelemetry (ADOT) logs
```console
fields @timestamp, log
| order @timestamp desc
| limit 100
```
<img width="1987" alt="Screenshot 2023-03-27 at 19 08 35" src="https://user-images.githubusercontent.com/10175027/228037030-95005f47-ff46-4f7a-af74-d31809c52fcd.png">
### Example - Using time series visualizations
[CloudWatch Logs syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)
provide powerful functions to extract data from your logs. The `stats()`
function allows you to calculate aggregate statistics with log field values.
This is useful to have visualization on non-metric data from your applications.
In the example below, we use the following query to graph the number of metrics
collected by the ADOT collector
```console
fields @timestamp, log
| parse log /"#metrics": (?<metrics_count>\d+)}/
| stats avg(metrics_count) by bin(5m)
| limit 100
```
!!! tip
You can add logs in your dashboards with logs panel types or time series
depending on your query results type.
<img width="2056" alt="image" src="https://user-images.githubusercontent.com/10175027/228037186-12691590-0bfe-465b-a83b-5c4f583ebf96.png">
!!! warning
Querying CloudWatch logs will incur costs per GB scanned. Use small time
windows and limits in your queries. Checkout the CloudWatch
[pricing page](https://aws.amazon.com/cloudwatch/pricing/) for more infos.
+13 -9
View File
@@ -5,32 +5,36 @@ Welcome to the AWS Observability Accelerator for Terraform!
The AWS Observability Accelerator for Terraform is a set of opinionated modules to
help you set up observability for your AWS environments with
AWS-managed observability services such as Amazon Managed Service for Prometheus,
Amazon Managed Grafana and AWS Distro for OpenTelemetry (ADOT).
Amazon Managed Grafana, AWS Distro for OpenTelemetry (ADOT) and Amazon CloudWatch.
We provide curated metrics, traces collection, alerting rules and Grafana dashboards
for your EKS infrastructure, Java/JMX, NGINX based workloads and custom applications.
We provide curated metrics, logs, traces collection, alerting rules and Grafana
dashboards for your EKS infrastructure, Java/JMX, NGINX based workloads and
your custom applications.
You also can monitor your Amazon Managed Service for Prometheus workspaces ingestion,
costs, active series with [this module](https://aws-observability.github.io/terraform-aws-observability-accelerator/workloads/managed-prometheus/).
<img width="1501" alt="image" src="images/dark-o11y-accelerator-amp-xray.png">
## Getting started
This project provides a set of Terraform modules to enable metrics and traces collection,
dashboards and alerts for monitoring:
This project provides a set of Terraform modules to enable metrics, logs and
traces collection, dashboards and alerts for monitoring:
- Amazon EKS clusters infrastructure
- Amazon EKS clusters infrastructure and applications
- NGINX workloads (running on Amazon EKS)
- Java/JMX workloads (running on Amazon EKS)
- Amazon Managed Service for Prometheus workspaces with Amazon CloudWatch
These modules can be directly configured in your existing Terraform configurations or ready
to be deployed in our packaged
These modules can be directly configured in your existing Terraform
configurations or ready to be deployed in our packaged
[examples](https://github.com/aws-observability/terraform-aws-observability-accelerator/tree/main/examples)
!!! tip
We have supporting examples for quick setup such as:
- Creating a new Amazon EKS cluster and a VPC
- Creating and configure an Amazon Managed Grafana workspace with SSO (coming soon)
- Creating and configure an Amazon Managed Grafana workspace with SSO
## Motivation