Skip to content

Commit 080bdad

Browse files
authored
Merge pull request #1875 from fluent/revert-1873-erics-filters-yaml-updates
2 parents bbed530 + 86a023d commit 080bdad

File tree

11 files changed

+283
-836
lines changed

11 files changed

+283
-836
lines changed

pipeline/filters/aws-metadata.md

Lines changed: 7 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ If you run Fluent Bit in a container, you might need to use instance metadata v1
2929
Run Fluent Bit from the command line:
3030

3131
```shell
32-
$ ./fluent-bit -c /PATH_TO_CONF_FILE/fluent-bit.conf
32+
bin/fluent-bit -c /PATH_TO_CONF_FILE/fluent-bit.conf
3333
```
3434

3535
You should see results like this:
3636

37-
```text
37+
```shell
3838
[2020/01/17 07:57:17] [ info] [engine] started (pid=32744)
3939
[0] dummy: [1579247838.000171227, {"message"=>"dummy", "az"=>"us-west-2c", "ec2_instance_id"=>"i-0c862eca9038f5aae", "ec2_instance_type"=>"t2.medium", "private_ip"=>"172.31.6.59", "vpc_id"=>"vpc-7ea11c06", "ami_id"=>"ami-0841edc20334f9287", "account_id"=>"YOUR_ACCOUNT_ID", "hostname"=>"ip-172-31-6-59.us-west-2.compute.internal"}]
4040
[0] dummy: [1601274509.970235760, {"message"=>"dummy", "az"=>"us-west-2c", "ec2_instance_id"=>"i-0c862eca9038f5aae", "ec2_instance_type"=>"t2.medium", "private_ip"=>"172.31.6.59", "vpc_id"=>"vpc-7ea11c06", "ami_id"=>"ami-0841edc20334f9287", "account_id"=>"YOUR_ACCOUNT_ID", "hostname"=>"ip-172-31-6-59.us-west-2.compute.internal"}]
@@ -44,38 +44,7 @@ You should see results like this:
4444

4545
The following is an example of a configuration file:
4646

47-
{% tabs %}
48-
{% tab title="fluent-bit.yaml" %}
49-
50-
```yaml
51-
pipeline:
52-
inputs:
53-
- name: dummy
54-
tag: dummy
55-
56-
filters:
57-
- name: aws
58-
match: '*'
59-
imds_version: v1
60-
az: true
61-
ec2_instance_id: true
62-
ec2_instance_type: true
63-
private_ip: true
64-
ami_id: true
65-
account_id: true
66-
hostname: true
67-
vpc_id: true
68-
tags_enabled: true
69-
70-
outputs:
71-
- name: stdout
72-
match: '*'
73-
```
74-
75-
{% endtab %}
76-
{% tab title="fluent-bit.conf" %}
77-
78-
```text
47+
```python
7948
[INPUT]
8049
Name dummy
8150
Tag dummy
@@ -99,9 +68,6 @@ pipeline:
9968
Match *
10069
```
10170

102-
{% endtab %}
103-
{% endtabs %}
104-
10571
## EC2 tags
10672

10773
EC2 Tags let you label and organize your EC2 instances by creating custom-defined key-value pairs. These tags are commonly used for resource management, cost allocation, and automation. Including them in the Fluent Bit-generated logs is almost essential.
@@ -118,33 +84,14 @@ To use the `tags_enabled true` feature in Fluent Bit, the [instance-metadata-tag
11884

11985
Assume the EC2 instance has many tags, some of which have lengthy values that are irrelevant to the logs you want to collect. Only two tags, `department` and `project`, are valuable for your purpose. The following configuration reflects this requirement:
12086

121-
{% tabs %}
122-
{% tab title="fluent-bit.yaml" %}
123-
124-
```yaml
125-
pipeline:
126-
127-
filters:
128-
- name: aws
129-
match: '*'
130-
tags_enabled: true
131-
tags_include: department,project
132-
```
133-
134-
{% endtab %}
135-
{% tab title="fluent-bit.conf" %}
136-
137-
```text
87+
```python
13888
[FILTER]
13989
Name aws
14090
Match *
14191
tags_enabled true
14292
tags_include department,project
14393
```
14494

145-
{% endtab %}
146-
{% endtabs %}
147-
14895
If you run Fluent Bit logs might look like the following:
14996

15097
```text
@@ -157,35 +104,16 @@ Suppose the EC2 instance has three tags: `Name:fluent-bit-docs-example`, `projec
157104

158105
Here is an example configuration that achieves this:
159106

160-
{% tabs %}
161-
{% tab title="fluent-bit.yaml" %}
162-
163-
```yaml
164-
pipeline:
165-
166-
filters:
167-
- name: aws
168-
match: '*'
169-
tags_enabled: true
170-
tags_exclude: department
171-
```
172-
173-
{% endtab %}
174-
{% tab title="fluent-bit.conf" %}
175-
176-
```text
107+
```python
177108
[FILTER]
178109
Name aws
179110
Match *
180111
tags_enabled true
181112
tags_exclude department
182113
```
183114

184-
{% endtab %}
185-
{% endtabs %}
186-
187115
The resulting logs might look like this:
188116

189-
```text
117+
```shell
190118
{"log"=>"aws is awesome", "az"=>"us-east-1a", "ec2_instance_id"=>"i-0e66fc7f9809d7168", "Name"=>"fluent-bit-docs-example", "project"=>"fluentbit"}
191-
```
119+
```

pipeline/filters/ecs-metadata.md

Lines changed: 3 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,9 @@ The following template variables can be used for values with the `ADD` option. S
3535

3636
### Configuration file
3737

38-
Below configurations assume a properly configured parsers file and 'storage.path' variable defined in the services
39-
section of the fluent bit configuration (not shown below).
40-
4138
#### Example 1: Attach Task ID and cluster name to container logs
4239

43-
{% tabs %}
44-
{% tab title="fluent-bit.yaml" %}
45-
46-
```yaml
47-
pipeline:
48-
inputs:
49-
- name: tail
50-
tag: ecs.*
51-
path: /var/lib/docker/containers/*/*.log
52-
docker_mode: on
53-
docker_mode_flush: 5
54-
docker_mode_parser: container_firstline
55-
parser: docker
56-
db: /var/fluent-bit/state/flb_container.db
57-
mem_buf_limit: 50MB
58-
skip_long_lines: on
59-
refresh_interval: 10
60-
rotate_wait: 30
61-
storage.type: filesystem
62-
read_from_head: off
63-
64-
filters:
65-
- name: ecs
66-
match: '*'
67-
ecs_tag_prefix: ecs.var.lib.docker.containers.
68-
add:
69-
- ecs_task_id $TaskID
70-
- cluster $ClusterName
71-
72-
outputs:
73-
- name: stdout
74-
match: '*'
75-
format: json_lines
76-
```
77-
78-
{% endtab %}
79-
{% tab title="fluent-bit.conf" %}
80-
81-
```text
40+
```python
8241
[INPUT]
8342
Name tail
8443
Tag ecs.*
@@ -108,9 +67,6 @@ pipeline:
10867
Format json_lines
10968
```
11069

111-
{% endtab %}
112-
{% endtabs %}
113-
11470
The output log should be similar to:
11571

11672
```text
@@ -124,42 +80,6 @@ The output log should be similar to:
12480

12581
#### Example 2: Attach customized resource name to container logs
12682

127-
{% tabs %}
128-
{% tab title="fluent-bit.yaml" %}
129-
130-
```yaml
131-
pipeline:
132-
inputs:
133-
- name: tail
134-
tag: ecs.*
135-
path: /var/lib/docker/containers/*/*.log
136-
docker_mode: on
137-
docker_mode_flush: 5
138-
docker_mode_parser: container_firstline
139-
parser: docker
140-
db: /var/fluent-bit/state/flb_container.db
141-
mem_buf_limit: 50MB
142-
skip_long_lines: on
143-
refresh_interval: 10
144-
rotate_wait: 30
145-
storage.type: filesystem
146-
read_from_head: off
147-
148-
filters:
149-
- name: ecs
150-
match: '*'
151-
ecs_tag_prefix: ecs.var.lib.docker.containers.
152-
add: resource $ClusterName.$TaskDefinitionFamily.$TaskID.$ECSContainerName
153-
154-
outputs:
155-
- name: stdout
156-
match: '*'
157-
format: json_lines
158-
```
159-
160-
{% endtab %}
161-
{% tab title="fluent-bit.conf" %}
162-
16383
```text
16484
[INPUT]
16585
Name tail
@@ -189,9 +109,6 @@ pipeline:
189109
Format json_lines
190110
```
191111

192-
{% endtab %}
193-
{% endtabs %}
194-
195112
The output log would be similar to:
196113

197114
```text
@@ -207,42 +124,9 @@ The template variables in the value for the `resource` key are separated by dot
207124

208125
#### Example 3: Attach cluster metadata to non-container logs
209126

210-
This examples shows a use case for the `Cluster_Metadata_Only` option attaching cluster metadata to ECS Agent logs.
211-
212-
{% tabs %}
213-
{% tab title="fluent-bit.yaml" %}
214-
215-
```yaml
216-
pipeline:
217-
inputs:
218-
- name: tail
219-
tag: ecsagent.*
220-
path: /var/log/ecs/*
221-
db: /var/fluent-bit/state/flb_ecs.db
222-
mem_buf_limit: 50MB
223-
skip_long_lines: on
224-
refresh_interval: 10
225-
rotate_wait: 30
226-
storage.type: filesystem
227-
# Collect all logs on instance
228-
read_from_head: on
127+
This examples shows a use case for the `Cluster_Metadata_Only` option- attaching cluster metadata to ECS Agent logs.
229128

230-
filters:
231-
- name: ecs
232-
match: '*'
233-
cluster_metadata_only: on
234-
add: cluster $ClusterName
235-
236-
outputs:
237-
- name: stdout
238-
match: '*'
239-
format: json_lines
240-
```
241-
242-
{% endtab %}
243-
{% tab title="fluent-bit.conf" %}
244-
245-
```text
129+
```python
246130
[INPUT]
247131
Name tail
248132
Tag ecsagent.*
@@ -267,6 +151,3 @@ pipeline:
267151
Match *
268152
Format json_lines
269153
```
270-
271-
{% endtab %}
272-
{% endtabs %}

pipeline/filters/geoip2-filter.md

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,7 @@ This plugin supports the following configuration parameters:
2222

2323
The following configuration processes the incoming `remote_addr` and appends country information retrieved from the GeoLite2 database.
2424

25-
{% tabs %}
26-
{% tab title="fluent-bit.yaml" %}
27-
28-
```yaml
29-
pipeline:
30-
inputs:
31-
- name: dummy
32-
dummy: {"remote_addr": "8.8.8.8"}
33-
34-
filters:
35-
- name: gioip2
36-
match: '*'
37-
database: GioLite2-City.mmdb
38-
lookup_key: remote_addr
39-
record:
40-
- country remote_addr %{country.names.en}
41-
- isocode remote_addr %{country.iso_code}
42-
43-
outputs:
44-
- name: stdout
45-
match: '*'
46-
```
47-
48-
{% endtab %}
49-
{% tab title="fluent-bit.conf" %}
50-
51-
```text
25+
```python
5226
[INPUT]
5327
Name dummy
5428
Dummy {"remote_addr": "8.8.8.8"}
@@ -66,9 +40,6 @@ pipeline:
6640
Match *
6741
```
6842

69-
{% endtab %}
70-
{% endtabs %}
71-
7243
Each `Record` parameter specifies the following triplet:
7344

7445
- `country`: The field name to be added to records.
@@ -77,6 +48,6 @@ Each `Record` parameter specifies the following triplet:
7748

7849
By running Fluent Bit with this configuration, you will see the following output:
7950

80-
```text
51+
```javascript
8152
{"remote_addr": "8.8.8.8", "country": "United States", "isocode": "US"}
82-
```
53+
```

0 commit comments

Comments
 (0)