Skip to content

Commit

Permalink
Merge pull request #26 from noosenergy/hotfix/intail-containers-source
Browse files Browse the repository at this point in the history
Hotfix/intail-containers-source
  • Loading branch information
pieeri authored May 31, 2023
2 parents b7cd8fa + f8ada36 commit ac93ba3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docker/exporter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get update \
&& gem install \
fluent-plugin-kubernetes_metadata_filter \
fluent-plugin-multi-format-parser \
fluent-plugin-rewrite-tag-filter \
fluent-plugin-concat \
fluent-plugin-loggly \
fluent-plugin-slack \
&& gem sources --clear-all \
Expand Down
43 changes: 26 additions & 17 deletions helm/chart/files/kubernetes.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,43 @@
<source>
@type tail
@id in_tail_container_logs
@label @KUBERNETES_LOG
@label @CONTAINERD_LOG
path /var/log/containers/*.log
pos_file /var/log/fluentd-containers.log.pos
# https://docs.fluentd.org/input/tail#read_from_head
read_from_head true
skip_refresh_on_startup true
# Tag required by default
tag kubernetes.*
# For Containerd CRI (for EKS >= v1.24)
<parse>
@type multi_format
# For docker CRI (for EKS < v1.24)
<pattern>
format json
time_key time
time_type string
time_format "%Y-%m-%dT%H:%M:%S.%NZ"
keep_time_key true
</pattern>
# For containerd CRI (for EKS >= v1.24)
<pattern>
# format /^(?<time>.+) (?<stream>stdout|stderr) [^ ]* (?<log>.*)$/
format /^(?<time>.+) (?<stream>stdout|stderr) (?<logtag>[FP]) (?<log>.*)$/
time_format "%Y-%m-%dT%H:%M:%S.%N%:z"
keep_time_key true
</pattern>
@type regexp
expression /^(?<time>.+) (?<stream>stdout|stderr) (?<logtag>[FP]) (?<log>.*)$/
time_key time
time_type string
time_format "%Y-%m-%dT%H:%M:%S.%N%:z"
keep_time_key false
</parse>
</source>

<label @CONTAINERD_LOG>
# Concatenate multiline logs
# https://github.com/fluent-plugins-nursery/fluent-plugin-concat
<filter **>
@type concat
@id filter_multiline_log
key log
use_first_timestamp true
partial_key logtag
partial_value P
separator ""
</filter>
<match **>
@type relabel
@label @KUBERNETES_LOG
</match>
</label>

<label @KUBERNETES_LOG>
# Add kubernetes metadata
# https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter
Expand Down

0 comments on commit ac93ba3

Please sign in to comment.