You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/configuration/log-routing.md
+31-7
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ Available routing metadata keys:
17
17
| Name | Type | Description | Empty |
18
18
|------|------|-------------|-------|
19
19
| namespaces |[]string | List of matching namespaces | All namespaces |
20
+
| namespaces_regex |[]string | List of matching ruby regex for namespaces | All namespaces |
20
21
| labels | map[string]string | Key - Value pairs of labels | All labels |
21
22
| hosts |[]string | List of matching hosts | All hosts |
22
23
| container_names |[]string | List of matching containers (not Pods) | All containers |
@@ -25,7 +26,7 @@ Available routing metadata keys:
25
26
26
27
To select or exclude logs you can use the `match` statement. Match is a collection
27
28
of `select` and `exclude` expressions. In both expression you can use the `labels`
28
-
attribute to filter for pod's labels. Moreover, in Cluster flow you can use `namespaces`
29
+
attribute to filter for pod's labels. Moreover, in Cluster flow you can use `namespaces` and `namespaces_regex`
29
30
as a selecting or excluding criteria.
30
31
31
32
If you specify more than one label in a `select` or `exclude` expression, the labels have a logical AND connection between them. For example, an `exclude` expression with two labels excludes messages that have both labels. If you want an OR connection between labels, list them in separate expressions. For example, to exclude messages that have one of two specified labels, create a separate `exclude` expression for each label.
@@ -133,7 +134,7 @@ Exclude logs with `app: nginx` labels from the namespace
133
134
134
135
### Example 3. Exclude and select logs by label
135
136
136
-
Select logs with `app: nginx` labels from the `default` namespace but exclude logs with `env: dev` labels
137
+
Select logs with `app: nginx` labels from the `default` namespace but exclude logs with `env: dev` labels
137
138
138
139
```yaml
139
140
apiVersion: logging.banzaicloud.io/v1beta1
@@ -155,7 +156,7 @@ Select logs with `app: nginx` labels from the `default` namespace but exclude lo
155
156
156
157
### Example 4. Exclude cluster logs by namespace
157
158
158
-
Select `app: nginx` from all namespaces except from `dev` and `sandbox`
159
+
Select `app: nginx` from all namespaces except from `dev` and `sandbox`
159
160
160
161
```yaml
161
162
apiVersion: logging.banzaicloud.io/v1beta1
@@ -175,9 +176,30 @@ Select `app: nginx` from all namespaces except from `dev` and `sandbox`
175
176
app: nginx
176
177
```
177
178
178
-
### Example 5. Exclude and select cluster logs by namespace
179
+
### Example 5. Exclude cluster logs by ruby regex namespace
179
180
180
-
Select `app: nginx` from all `prod` and `infra` namespaces but exclude cluster logs from `dev`, `sandbox` namespaces
181
+
Select `app: nginx` from all namespaces except from those ending with `-dev`
182
+
183
+
```yaml
184
+
apiVersion: logging.banzaicloud.io/v1beta1
185
+
kind: ClusterFlow
186
+
metadata:
187
+
name: clusterflow-sample
188
+
spec:
189
+
globalOutputRefs:
190
+
- forward-output-sample
191
+
match:
192
+
- exclude:
193
+
namespaces_regex:
194
+
- .*-dev$
195
+
- select:
196
+
labels:
197
+
app: nginx
198
+
```
199
+
200
+
### Example 5. Exclude and select cluster logs by namespace and ruby regex
201
+
202
+
Select `app: nginx` from `infra` namespace and all namespaces starting with `prod-` but exclude cluster logs from `sandbox` namespace and all namespaces starting with `dev-`,
181
203
182
204
```yaml
183
205
apiVersion: logging.banzaicloud.io/v1beta1
@@ -190,14 +212,16 @@ Select `app: nginx` from all `prod` and `infra` namespaces but exclude cluster l
0 commit comments