Skip to content

Commit a285430

Browse files
committed
Pipeline: filters: ecs-metadata: update for style
Signed-off-by: Lynette Miles <[email protected]>
1 parent 2b6b548 commit a285430

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

pipeline/filters/ecs-metadata.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
1-
# ECS Metadata
1+
# ECS metadata
22

3-
The _ECS Filter_ Enriches logs with AWS Elastic Container Service Metadata. The plugin can enrich logs with task, cluster and container metadata. The plugin uses the [ECS Agent introspection API](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-introspection.html) to obtain metadata. This filter only works with the ECS EC2 launch type. The filter only works when Fluent Bit is running on an ECS EC2 Container Instance and has access to the ECS Agent introspection API. The filter is not supported on ECS Fargate. To obtain metadata on ECS Fargate, use the [built-in FireLens metadata](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html) or the [AWS for Fluent Bit init](https://github.com/aws/aws-for-fluent-bit/blob/mainline/use_cases/init-process-for-fluent-bit/README.md) project.
3+
The _ECS Filter_ enriches logs with AWS Elastic Container Service metadata. The plugin can enrich logs with task, cluster, and container metadata. The plugin uses the [ECS Agent introspection API](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-introspection.html) to obtain metadata. This filter only works with the ECS EC2 launch type. The filter only works when Fluent Bit is running on an ECS EC2 Container Instance and has access to the ECS Agent introspection API.
44

5-
## Configuration Parameters
5+
The filter isn't supported on ECS Fargate. To obtain metadata on ECS Fargate, use the [built-in FireLens metadata](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html) or the [AWS for Fluent Bit init](https://github.com/aws/aws-for-fluent-bit/blob/mainline/use_cases/init-process-for-fluent-bit/README.md) project.
6+
7+
## Configuration parameters
68

79
The plugin supports the following configuration parameters:
810

911
| Key | Description | Default |
1012
| :--- | :--- | :--- |
11-
| Add | This parameter is similar to the ADD option in the [modify filter](https://docs.fluentbit.io/manual/pipeline/filters/modify). You can specify it any number of times and it takes two arguments, a KEY name and VALUE. The value uses Fluent Bit [record_accessor](https://docs.fluentbit.io/manual/v/1.5/administration/configuring-fluent-bit/record-accessor) syntax to create a template that uses ECS Metadata values. See the list below for supported metadata templating keys. This option is designed to give you full power to control both the key names for metadata as well as the format for metadata values. See the examples below for more. | No default |
12-
| ECS\_Tag\_Prefix | This parameter is similar to the Kube_Tag_Prefix option in the [Kubernetes filter](https://docs.fluentbit.io/manual/pipeline/filters/kubernetes) and performs the same function. The full log tag should be prefixed with this string and after the prefix the filter must find the next characters in the tag to be the Docker Container Short ID (the first 12 characters of the full container ID). The filter uses this to identify which container the log came from so it can find which task it is a part of. See the design section below for more information. If not specified, it defaults to empty string, meaning that the tag must be prefixed with the 12 character container short ID. If you just want to attach cluster metadata to system/OS logs from processes that do not run as part of containers or ECS Tasks, then do not set this parameter and enable the Cluster\_Metadata\_Only option | emptry string |
13-
| Cluster\_Metadata\_Only | When enabled, the plugin will only attempt to attach cluster metadata values. This is useful if you want to attach cluster metadata to system/OS logs from processes that do not run as part of containers or ECS Tasks. | Off |
14-
| ECS\_Meta\_Cache\_TTL | The filter builds a hash table in memory mapping each unique container short ID to its metadata. This option sets a max TTL for objects in the hash table. You should set this if you have frequent container/task restarts. For example, your cluster runs short running batch jobs that complete in less than 10 minutes, there is no reason to keep any stored metadata longer than 10 minutes. So you would set this parameter to "10m". | 1h (1 hour) |
13+
| `Add` | Similar to the `ADD` option in the [modify filter](https://docs.fluentbit.io/manual/pipeline/filters/modify). You can specify it multiple times. It takes two arguments: a `KEY` name and `VALUE`. The value uses Fluent Bit [`record_accessor`](https://docs.fluentbit.io/manual/v/1.5/administration/configuring-fluent-bit/record-accessor) syntax to create a template that uses ECS Metadata values. See the list of supported metadata templating keys. This option is designed to give you full power to control both the key names for metadata and the format for metadata values. | _none_ |
14+
| `ECS_Tag_Prefix` | Similar to the `Kube_Tag_Prefix` option in the [Kubernetes filter](https://docs.fluentbit.io/manual/pipeline/filters/kubernetes) and performs the same function. The full log tag should be prefixed with this string and after the prefix the filter must find the next characters in the tag to be the Docker Container Short ID (the first 12 characters of the full container ID). The filter uses this to identify which container the log came from so it can find which task it's a part of. See the design section for more information. If not specified, it defaults to empty string, meaning that the tag must be prefixed with the 12 character container short ID. If you want to attach cluster metadata to system or OS logs from processes that don't run as part of containers or ECS Tasks, don't set this parameter and enable the `Cluster_Metadata_Only` option | empty string |
15+
| `Cluster_Metadata_Only` | When enabled, the plugin will only attempt to attach cluster metadata values. Use to attach cluster metadata to system or OS logs from processes that don't run as part of containers or ECS Tasks. | `Off` |
16+
| `ECS_Meta_Cache_TTL` | The filter builds a hash table in memory mapping each unique container short ID to its metadata. This option sets a max `TTL` for objects in the hash table. You should set this if you have frequent container or task restarts. For example, your cluster runs short running batch jobs that complete in less than 10 minutes, there is no reason to keep any stored metadata longer than 10 minutes. So you would set this parameter to `10m`. | `1h` |
1517

16-
### Supported Templating Variables for the ADD option
18+
### Supported templating variables for the `ADD` option
1719

18-
The following template variables can be used for values with the `Add` option. See the tutorial below for examples.
20+
The following template variables can be used for values with the `Add` option. See the tutorial in the sections following for examples.
1921

20-
| Variable | Description | Supported with Cluster\_Metadata\_Only On |
22+
| Variable | Description | Supported with `Cluster_Metadata_Only` on |
2123
| :--- | :--- | :--- |
22-
| `$ClusterName` | The ECS cluster name. Fluent Bit is running on EC2 instance(s) that are part of this cluster. | Yes |
23-
| `$ContainerInstanceArn` | The full ARN of the ECS EC2 Container Instance. This is the instance that Fluent Bit is running on. | Yes |
24-
| `$ContainerInstanceID` | The ID of the ECS EC2 Container Instance. | Yes |
25-
| `$ECSAgentVersion` | The Version string of the ECS Agent that is running on the container instance. | Yes |
26-
| `$ECSContainerName` | The name of the container from which the log originated. This is the name in your ECS Task Definition. | No |
27-
| `$DockerContainerName` | The name of the container from which the log originated. This is the name obtained from Docker and is the name shown if you run `docker ps` on the instance. | No |
28-
| `$ContainerID` | The ID of the container from which the log originated. This is the full 64 character long container ID. | No |
29-
| `$TaskDefinitionFamily` | The family name of the task definition for the task from which the log originated. | No |
30-
| `$TaskDefinitionVersion` | The version/revision of the task definition for the task from which the log originated. | No |
31-
| `$TaskID` | The ID of the ECS Task from which the log originated. | No |
32-
| `$TaskARN` | The full ARN of the ECS Task from which the log originated. | No |
33-
34-
35-
### Configuration File
24+
| `$ClusterName` | The ECS cluster name. Fluent Bit is running on EC2 instances that are part of this cluster. | `Yes` |
25+
| `$ContainerInstanceArn` | The full ARN of the ECS EC2 Container Instance. This is the instance that Fluent Bit is running on. | `Yes` |
26+
| `$ContainerInstanceID` | The ID of the ECS EC2 Container Instance. | `Yes` |
27+
| `$ECSAgentVersion` | The Version string of the ECS Agent running on the container instance. | `Yes` |
28+
| `$ECSContainerName` | The name of the container from which the log originated. This is the name in your ECS Task Definition. | `No` |
29+
| `$DockerContainerName` | The name of the container from which the log originated. This is the name obtained from Docker and is the name shown if you run `docker ps` on the instance. | `No` |
30+
| `$ContainerID` | The ID of the container from which the log originated. This is the full 64 character long container ID. | `No` |
31+
| `$TaskDefinitionFamily` | The family name of the task definition for the task from which the log originated. | `No` |
32+
| `$TaskDefinitionVersion` | The version or revision of the task definition for the task from which the log originated. | `No` |
33+
| `$TaskID` | The ID of the ECS Task from which the log originated. | `No` |
34+
| `$TaskARN` | The full ARN of the ECS Task from which the log originated. | `No` |
35+
36+
### Configuration file
3637

3738
#### Example 1: Attach Task ID and cluster name to container logs
3839

39-
```text
40+
```python
4041
[INPUT]
4142
Name tail
4243
Tag ecs.*
@@ -67,6 +68,7 @@ The following template variables can be used for values with the `Add` option. S
6768
```
6869

6970
The output log should be similar to:
71+
7072
```text
7173
{
7274
"date":1665003546.0,
@@ -108,6 +110,7 @@ The output log should be similar to:
108110
```
109111

110112
The output log would be similar to:
113+
111114
```text
112115
{
113116
"date":1665003546.0,
@@ -116,14 +119,14 @@ The output log would be similar to:
116119
}
117120
```
118121

119-
Notice that the template variables in the value for the `resource` key are separated by dot characters, only dots and commas
120-
(`.` and `,`) can come after a template variable. For more information, please check the [Record accessor limitation's section](../../administration/configuring-fluent-bit/classic-mode/record-accessor.md#limitations-of-record_accessor-templating).
122+
The template variables in the value for the `resource` key are separated by dot characters. Only dots and commas
123+
(`.` and `,`) can come after a template variable. For more information, see the [Record accessor limitation's section](../../administration/configuring-fluent-bit/classic-mode/record-accessor.md#limitations-of-record_accessor-templating).
121124

122125
#### Example 3: Attach cluster metadata to non-container logs
123126

124-
This examples shows a use case for the `Cluster_Metadata_Only` option- attaching cluster metadata to ECS Agent logs.
127+
This examples shows a use case for the `Cluster_Metadata_Only` option- attaching cluster metadata to ECS Agent logs.
125128

126-
```text
129+
```python
127130
[INPUT]
128131
Name tail
129132
Tag ecsagent.*
@@ -148,4 +151,3 @@ This examples shows a use case for the `Cluster_Metadata_Only` option- attaching
148151
Match *
149152
Format json_lines
150153
```
151-

vale-styles/FluentBit/Acronyms.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ exceptions:
2626
- DNS
2727
- DPI
2828
- DPPS
29+
- ECS
2930
- FAQ
3031
- FIPS
3132
- GCC

0 commit comments

Comments
 (0)