|
| 1 | +# Examples |
| 2 | + |
| 3 | +## Docker |
| 4 | + |
| 5 | +With Docker images, using the `awslogs` log driver will send your container logs to CloudWatch Logs. All you have to do is write to STDOUT and your EMF logs will be processed. |
| 6 | + |
| 7 | +[Official Docker documentation for `awslogs` driver](https://docs.docker.com/config/containers/logging/awslogs/) |
| 8 | + |
| 9 | +## ECS and Fargate |
| 10 | + |
| 11 | +With ECS and Fargate, you can use the `awslogs` log driver to have your logs sent to CloudWatch Logs on your behalf. After configuring your task to use the `awslogs` log driver, you may write your EMF logs to STDOUT and they will be processed. |
| 12 | + |
| 13 | +[ECS documentation on `awslogs` log driver](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html) |
| 14 | + |
| 15 | +## Fluent Bit and Fluentd |
| 16 | + |
| 17 | +Fluent Bit can be used to collect logs and push them to CloudWatch Logs. After configuring the Amazon CloudWatch Logs output plugin, you may write your EMF logs to STDOUT and they will be processed. |
| 18 | + |
| 19 | +[Getting Started with Fluent Bit](https://docs.fluentbit.io/manual/installation/getting-started-with-fluent-bit) |
| 20 | + |
| 21 | +[Amazon CloudWatch output plugin for Fluent Bit](https://docs.fluentbit.io/manual/pipeline/outputs/cloudwatch) |
| 22 | + |
| 23 | +### Example Metrics |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "_aws": { |
| 28 | + "Timestamp": 1583902595342, |
| 29 | + "CloudWatchMetrics": [ |
| 30 | + { |
| 31 | + "Dimensions": [[ "ServiceName", "ServiceType" ]], |
| 32 | + "Metrics": [{ "Name": "ProcessingTime", "Unit": "Milliseconds" }], |
| 33 | + "Namespace": "aws-embedded-metrics" |
| 34 | + } |
| 35 | + ] |
| 36 | + }, |
| 37 | + "ServiceName": "example", |
| 38 | + "ServiceType": "AWS::ECS::Container", |
| 39 | + "Method": "GET", |
| 40 | + "Url": "/test", |
| 41 | + "containerId": "702e4bcf1345", |
| 42 | + "createdAt": "2020-03-11T04:54:24.981207801Z", |
| 43 | + "startedAt": "2020-03-11T04:54:25.594413051Z", |
| 44 | + "image": "<account-id>.dkr.ecr.<region>.amazonaws.com/emf-examples:latest", |
| 45 | + "cluster": "emf-example", |
| 46 | + "taskArn": "arn:aws:ecs:<region>:<account-id>:task/2fe946f6-8a2e-41a4-8fec-c4983bad8f74", |
| 47 | + "ProcessingTime": 5 |
| 48 | +} |
| 49 | +``` |
0 commit comments