@@ -47,7 +47,12 @@ $ bin/fluent-bit -i tail -p 'path=lines.txt' -F grep -p 'regex=log aa' -m '*' -o
47
47
48
48
### Configuration File
49
49
50
+ {% tabs %}
51
+ {% tab title="fluent-bit.conf" %}
50
52
``` python
53
+ [SERVICE ]
54
+ parsers_file / path/ to/ parsers.conf
55
+
51
56
[INPUT ]
52
57
name tail
53
58
path lines.txt
@@ -62,6 +67,28 @@ $ bin/fluent-bit -i tail -p 'path=lines.txt' -F grep -p 'regex=log aa' -m '*' -o
62
67
name stdout
63
68
match *
64
69
```
70
+ {% endtab %}
71
+
72
+ {% tab title="fluent-bit.yaml" %}
73
+ ``` yaml
74
+ service :
75
+ parsers_file : /path/to/parsers.conf
76
+ pipeline :
77
+ inputs :
78
+ - name : tail
79
+ path : lines.txt
80
+ parser : json
81
+ filters :
82
+ - name : grep
83
+ match : ' *'
84
+ regex : log aa
85
+ outputs :
86
+ - name : stdout
87
+ match : ' *'
88
+
89
+ ```
90
+ {% endtab %}
91
+ {% endtabs %}
65
92
66
93
The filter allows to use multiple rules which are applied in order, you can have many _ Regex_ and _ Exclude_ entries as required.
67
94
@@ -88,12 +115,25 @@ If you want to match or exclude records based on nested values, you can use a [R
88
115
89
116
if you want to exclude records that match given nested field \( for example ` kubernetes.labels.app ` \) , you can use the following rule:
90
117
118
+ {% tabs %}
119
+ {% tab title="fluent-bit.conf" %}
91
120
``` python
92
121
[FILTER ]
93
122
Name grep
94
123
Match *
95
124
Exclude $ kubernetes[' labels' ][' app' ] myapp
96
125
```
126
+ {% endtab %}
127
+
128
+ {% tab title="fluent-bit.yaml" %}
129
+ ``` yaml
130
+ filters :
131
+ - name : grep
132
+ match : ' *'
133
+ exclude : $kubernetes['labels']['app'] myapp
134
+ ` ` `
135
+ {% endtab %}
136
+ {% endtabs %}
97
137
98
138
### Excluding records missing/invalid fields
99
139
@@ -103,6 +143,9 @@ A simple way to do this is just to `exclude` with a regex that matches anything,
103
143
104
144
Here is an example that checks for a specific valid value for the key as well :
105
145
146
+
147
+ {% tabs %}
148
+ {% tab title="fluent-bit.conf" %}
106
149
```
107
150
# Use Grep to verify the contents of the iot_timestamp value.
108
151
# If the iot_timestamp key does not exist, this will fail
@@ -113,6 +156,18 @@ Here is an example that checks for a specific valid value for the key as well:
113
156
Match iots_thread.*
114
157
Regex iot_timestamp ^\d{4}-\d{2}-\d{2}
115
158
```
159
+ {% endtab %}
160
+
161
+ {% tab title="fluent-bit.yaml" %}
162
+ ```yaml
163
+ filters:
164
+ - name: grep
165
+ alias: filter-iots-grep
166
+ match: iots_thread.*
167
+ regex: iot_timestamp ^\d{4}-\d{2}-\d{2}
168
+ ```
169
+ {% endtab %}
170
+ {% endtabs %}
116
171
117
172
The specified key ` iot_timestamp ` must match the expected expression - if it does not or is missing/empty then it will be excluded.
118
173
@@ -122,6 +177,9 @@ If you want to set multiple `Regex` or `Exclude`, you can use `Logical_Op` prope
122
177
123
178
Note: If ` Logical_Op ` is set, setting both 'Regex' and ` Exclude ` results in an error.
124
179
180
+
181
+ {% tabs %}
182
+ {% tab title="fluent-bit.conf" %}
125
183
``` python
126
184
[INPUT ]
127
185
Name dummy
@@ -138,6 +196,27 @@ Note: If `Logical_Op` is set, setting both 'Regex' and `Exclude` results in an e
138
196
[OUTPUT ]
139
197
Name stdout
140
198
```
199
+ {% endtab %}
200
+
201
+ {% tab title="fluent-bit.yaml" %}
202
+ ``` yaml
203
+ pipeline :
204
+ inputs :
205
+ - name : dummy
206
+ dummy : ' {"endpoint":"localhost", "value":"something"}'
207
+ tag : dummy
208
+ filters :
209
+ - name : grep
210
+ match : ' *'
211
+ logical_op : or
212
+ regex :
213
+ - value something
214
+ - value error
215
+ outputs :
216
+ - name : stdout
217
+ ` ` `
218
+ {% endtab %}
219
+ {% endtabs %}
141
220
142
221
Output will be
143
222
` ` `
0 commit comments