Skip to content

Commit 1280ce6

Browse files
Merge pull request #283 from joseacl/issue-2010
Update documentation to reflect select/exclude namespaces regex in ClusterFlow
2 parents 5910634 + f275d7c commit 1280ce6

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

content/docs/configuration/log-routing.md

+31-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Available routing metadata keys:
1717
| Name | Type | Description | Empty |
1818
|------|------|-------------|-------|
1919
| namespaces | []string | List of matching namespaces | All namespaces |
20+
| namespaces_regex | []string | List of matching ruby regex for namespaces | All namespaces |
2021
| labels | map[string]string | Key - Value pairs of labels | All labels |
2122
| hosts | []string | List of matching hosts | All hosts |
2223
| container_names | []string | List of matching containers (not Pods) | All containers |
@@ -25,7 +26,7 @@ Available routing metadata keys:
2526

2627
To select or exclude logs you can use the `match` statement. Match is a collection
2728
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`
2930
as a selecting or excluding criteria.
3031

3132
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
133134

134135
### Example 3. Exclude and select logs by label
135136

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
137138

138139
```yaml
139140
apiVersion: logging.banzaicloud.io/v1beta1
@@ -155,7 +156,7 @@ Select logs with `app: nginx` labels from the `default` namespace but exclude lo
155156

156157
### Example 4. Exclude cluster logs by namespace
157158

158-
Select `app: nginx` from all namespaces except from `dev` and `sandbox`
159+
Select `app: nginx` from all namespaces except from `dev` and `sandbox`
159160

160161
```yaml
161162
apiVersion: logging.banzaicloud.io/v1beta1
@@ -175,9 +176,30 @@ Select `app: nginx` from all namespaces except from `dev` and `sandbox`
175176
app: nginx
176177
```
177178

178-
### Example 5. Exclude and select cluster logs by namespace
179+
### Example 5. Exclude cluster logs by ruby regex namespace
179180

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-`,
181203

182204
```yaml
183205
apiVersion: logging.banzaicloud.io/v1beta1
@@ -190,14 +212,16 @@ Select `app: nginx` from all `prod` and `infra` namespaces but exclude cluster l
190212
match:
191213
- exclude:
192214
namespaces:
193-
- dev
194215
- sandbox
216+
namespaces_regex:
217+
- ^dev-.*
195218
- select:
196219
labels:
197220
app: nginx
198221
namespaces:
199-
- prod
200222
- infra
223+
namespaces_regex:
224+
- ^prod-.*
201225
```
202226

203227
### Example 6. Multiple labels - AND

0 commit comments

Comments
 (0)