Skip to content

Commit

Permalink
salt: Improve fluent-bit parser
Browse files Browse the repository at this point in the history
Remove the date from the logs once parsed by
fluent-bit as we do not need it anymore and
it allows to improve the logs readability.
Plus, it is also need by the alert history
feature, this way we only end up with a JSON
formatted alert in logs which makes it easier
to parse/use by other components.

Refs: #3180
(cherry picked from commit 73f46cf)
  • Loading branch information
alexandre-allard committed Apr 7, 2021
1 parent 5ce7206 commit bb1c50b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions salt/metalk8s/addons/logging/fluent-bit/deployed/configmap.sls
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Create fluent-bit ConfigMap:
Name tail
Tag kube.*
Path /var/log/containers/*.log
Parser docker
Parser container
DB /run/fluent-bit/flb_kube.db
Mem_Buf_Limit 5MB
[INPUT]
Expand Down Expand Up @@ -76,6 +76,10 @@ Create fluent-bit ConfigMap:
Remove BOOT_ID
Remove UID
Remove GID
[FILTER]
Name modify
Match kube.*
Remove logtag
{%- for index in range(loki.spec.deployment.replicas) %}
[Output]
Name loki
Expand Down Expand Up @@ -109,7 +113,9 @@ Create fluent-bit ConfigMap:
}
parsers.conf: |-
[PARSER]
Name docker
Format json
Name container
Format regex
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]+) (?<message>.+)$
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
Time_Keep Off

0 comments on commit bb1c50b

Please sign in to comment.