More logging fixes, try to decode json at the source

This commit is contained in:
Stefan Reimer 2020-10-05 09:01:50 -07:00
parent 9252d3005a
commit bddafc142e
1 changed files with 26 additions and 15 deletions

View File

@ -171,6 +171,7 @@ fluentd:
key_name message key_name message
remove_key_name_field true remove_key_name_field true
reserve_data true reserve_data true
reserve_time true
# inject_key_prefix message_json. # inject_key_prefix message_json.
emit_invalid_record_to_error false emit_invalid_record_to_error false
<parse> <parse>
@ -186,21 +187,31 @@ fluent-bit:
config: config:
outputs: | outputs: |
[OUTPUT] [OUTPUT]
Match * Match *
Name forward Name forward
Host logging-fluentd Host logging-fluentd
Port 24224 Port 24224
Shared_Key cloudbender
Send_options true
Require_ack_response true
customParsers: |
[PARSER]
Name cri-log
Format regex
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<log>.*)$
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
inputs: | inputs: |
[INPUT] [INPUT]
Name tail Name tail
Path /var/log/containers/*.log Path /var/log/containers/*.log
Parser cri Parser cri-log
Tag kube.* Tag kube.*
Mem_Buf_Limit 16MB Mem_Buf_Limit 16MB
Skip_Long_Lines On Skip_Long_Lines On
Refresh_Interval 10 Refresh_Interval 10
Exclude_Path *.gz,*.zip
DB /var/log/flb_kube.db DB /var/log/flb_kube.db
DB.Sync Normal DB.Sync Normal
[INPUT] [INPUT]
@ -225,14 +236,14 @@ fluent-bit:
Match kube.* Match kube.*
Merge_Log On Merge_Log On
Keep_Log Off Keep_Log Off
K8S-Logging.Parser On K8S-Logging.Parser Off
K8S-Logging.Exclude On K8S-Logging.Exclude Off
[FILTER] #[FILTER]
Name lua # Name lua
Match kube.* # Match kube.*
script /fluent-bit/etc/functions.lua # script /fluent-bit/etc/functions.lua
call dedot # call dedot
service: | service: |
[SERVICE] [SERVICE]
@ -286,11 +297,11 @@ fluent-bit:
local reassemble_key = tag local reassemble_key = tag
-- if partial line, accumulate -- if partial line, accumulate
if record.logtag == 'P' then if record.logtag == 'P' then
reassemble_state[reassemble_key] = reassemble_state[reassemble_key] or "" .. record.message reassemble_state[reassemble_key] = reassemble_state[reassemble_key] or "" .. record.log
return -1, 0, 0 return -1, 0, 0
end end
-- otherwise it's a full line, concatenate with accumulated partial lines if any -- otherwise it's a full line, concatenate with accumulated partial lines if any
record.message = reassemble_state[reassemble_key] or "" .. (record.message or "") record.log = reassemble_state[reassemble_key] or "" .. (record.log or "")
reassemble_state[reassemble_key] = nil reassemble_state[reassemble_key] = nil
return 1, timestamp, record return 1, timestamp, record
end end