Skip to content

Commit 9560233

Browse files
Merge pull request #250 from kube-logging/containerd-fix-to-fluentbit-examples
Adds containerd parsing example to the Fluent Bit page
2 parents b8ba9e4 + fdaafa1 commit 9560233

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

content/docs/logging-infrastructure/fluentbit.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,35 @@ The following sections show you some examples on configuring Fluent Bit. For the
9696

9797
> Note: These examples use the traditional method that configures the Fluent Bit deployment using **spec.fluentbit** section of {{% xref "/docs/logging-infrastructure/logging.md" %}}.
9898

99+
## Containerd log fields
100+
101+
The following example defines a custom Fluent Bit parser that places the parsed containerd log messages into the `log` field instead of the `message` field to be backwards compatible with docker container runtimes.
102+
103+
```yaml
104+
apiVersion: logging.banzaicloud.io/v1beta1
105+
kind: FluentbitAgent
106+
metadata:
107+
name: containerd
108+
spec:
109+
inputTail:
110+
Parser: cri-log-key
111+
# Parser that populates `log` instead of `message` to enable the Kubernetes filter's Merge_Log feature to work
112+
# Mind the indentation, otherwise Fluent Bit will parse the whole message into the `log` key
113+
customParsers: |
114+
[PARSER]
115+
Name cri-log-key
116+
Format regex
117+
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<log>.*)$
118+
Time_Key time
119+
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
120+
# Required key remap if one wants to rely on the existing auto-detected log key in the fluentd parser and concat filter otherwise should be omitted
121+
filterModify:
122+
- rules:
123+
- Rename:
124+
key: log
125+
value: message
126+
```
127+
99128
## Filters
100129
101130
### Kubernetes (filterKubernetes)

0 commit comments

Comments
 (0)