fluent-bit tag improvements
This commit is contained in:
parent
b0286ff858
commit
cb3c6a93ba
@ -2,7 +2,7 @@ apiVersion: v2
|
|||||||
name: kubezero-logging
|
name: kubezero-logging
|
||||||
description: KubeZero Umbrella Chart for complete EFK stack
|
description: KubeZero Umbrella Chart for complete EFK stack
|
||||||
type: application
|
type: application
|
||||||
version: 0.3.9
|
version: 0.4.0
|
||||||
appVersion: 1.2.1
|
appVersion: 1.2.1
|
||||||
home: https://kubezero.com
|
home: https://kubezero.com
|
||||||
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
|
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
|
||||||
|
@ -208,46 +208,39 @@ fluent-bit:
|
|||||||
Name tail
|
Name tail
|
||||||
Path /var/log/containers/*.log
|
Path /var/log/containers/*.log
|
||||||
Parser cri-log
|
Parser cri-log
|
||||||
Tag kube.*
|
Tag cri.*
|
||||||
Mem_Buf_Limit 16MB
|
Mem_Buf_Limit 16MB
|
||||||
Skip_Long_Lines On
|
Skip_Long_Lines On
|
||||||
Refresh_Interval 10
|
Refresh_Interval 10
|
||||||
DB /var/log/flb_kube.db
|
DB /var/log/flb_kube.db
|
||||||
DB.Sync Normal
|
DB.Sync Normal
|
||||||
[INPUT]
|
|
||||||
Name tail
|
|
||||||
Path /var/log/kubernetes/audit.log
|
|
||||||
Parser json
|
|
||||||
Tag audit.api-server
|
|
||||||
Mem_Buf_Limit 8MB
|
|
||||||
Skip_Long_Lines On
|
|
||||||
DB /var/log/flb_kube_audit.db
|
|
||||||
DB.Sync Normal
|
|
||||||
|
|
||||||
filters: |
|
filters: |
|
||||||
[FILTER]
|
[FILTER]
|
||||||
Name lua
|
Name lua
|
||||||
Match kube.*
|
Match cri.*
|
||||||
script /fluent-bit/etc/functions.lua
|
script /fluent-bit/etc/functions.lua
|
||||||
call reassemble_cri_logs
|
call reassemble_cri_logs
|
||||||
|
|
||||||
[FILTER]
|
[FILTER]
|
||||||
Name kubernetes
|
Name kubernetes
|
||||||
Match kube.*
|
Match cri.*
|
||||||
Merge_Log On
|
Merge_Log On
|
||||||
|
Merge_Log_Key kube
|
||||||
|
Kube_Tag_Prefix cri.var.log.containers.
|
||||||
Keep_Log Off
|
Keep_Log Off
|
||||||
K8S-Logging.Parser Off
|
K8S-Logging.Parser Off
|
||||||
K8S-Logging.Exclude Off
|
K8S-Logging.Exclude Off
|
||||||
|
|
||||||
#[FILTER]
|
[FILTER]
|
||||||
# Name lua
|
Name rewrite_tag
|
||||||
# Match kube.*
|
Match cri.*
|
||||||
# script /fluent-bit/etc/functions.lua
|
Emitter_Name kube_tag_rewriter
|
||||||
# call dedot
|
Rule logtag F kube.$kubernetes['namespace_name'].$kubernetes['container_name'] false
|
||||||
|
|
||||||
service: |
|
service: |
|
||||||
[SERVICE]
|
[SERVICE]
|
||||||
Flush 5
|
Flush 1
|
||||||
Daemon Off
|
Daemon Off
|
||||||
Log_Level warn
|
Log_Level warn
|
||||||
Parsers_File parsers.conf
|
Parsers_File parsers.conf
|
||||||
@ -257,36 +250,6 @@ fluent-bit:
|
|||||||
HTTP_Port 2020
|
HTTP_Port 2020
|
||||||
|
|
||||||
lua: |
|
lua: |
|
||||||
function dedot(tag, timestamp, record)
|
|
||||||
if record["kubernetes"] == nil then
|
|
||||||
return 0, 0, 0
|
|
||||||
end
|
|
||||||
dedot_keys(record["kubernetes"]["annotations"])
|
|
||||||
dedot_keys(record["kubernetes"]["labels"])
|
|
||||||
return 1, timestamp, record
|
|
||||||
end
|
|
||||||
|
|
||||||
function dedot_keys(map)
|
|
||||||
if map == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local new_map = {}
|
|
||||||
local changed_keys = {}
|
|
||||||
for k, v in pairs(map) do
|
|
||||||
local dedotted = string.gsub(k, "%.", "_")
|
|
||||||
if dedotted ~= k then
|
|
||||||
new_map[dedotted] = v
|
|
||||||
changed_keys[k] = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for k in pairs(changed_keys) do
|
|
||||||
map[k] = nil
|
|
||||||
end
|
|
||||||
for k, v in pairs(new_map) do
|
|
||||||
map[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local reassemble_state = {}
|
local reassemble_state = {}
|
||||||
|
|
||||||
function reassemble_cri_logs(tag, timestamp, record)
|
function reassemble_cri_logs(tag, timestamp, record)
|
||||||
|
Loading…
Reference in New Issue
Block a user