The following set of logs will for forwarded:
/var/log/containers/*.logsystemd (kubelet.service)Run the following on both the TCA-M and TCA-CP:
http://<fqdn>:9443https://<fqdn>:9543https://<TCA-M_IP>https://<fqdn>:9543https://<TCA-M_IP>https://<TCA-M_IP>systemsettings addonsystemsettings addon to the Workload clusterNote: These configurations will forward the cluster's journal logs.
NOTE: The Fluent-bit configuration provides the user with more flexibility to manage which logs can be forwarded to the log server.
| Component | syslog setting | Logs forwarded | Required | |
| 1 | TCA-M and TCA-CP Logs |
|
|
Y |
| 2 | Management cluster |
|
|
Y |
| 3 | Workload cluster |
|
|
N |
| 4 | Pods on Workload cluster |
|
|
Y |
Fluent-bit is used to forward the system logs. Once configured, a couple of Fluent-bit pods will be created up and configuration is stored in a ConfigMap:
kubectl -n fluent-system get cm fluent-bit -o yaml
[SERVICE]
Flush 10
Daemon Off
Log_Level info
Parsers_File parsers.conf
Parsers_File custom_parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
[INPUT]
Name tail
Path /var/log/containers/*.log
Parser docker
Tag logs_kube.*
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Buffer_Chunk_Size 64KB
Buffer_Max_Size 128KB
[INPUT]
Name systemd
Tag logs_host.*
Systemd_Filter _SYSTEMD_UNIT=kubelet.service
Read_From_Tail On
[FILTER]
Name kubernetes
Match logs_kube.*
Merge_Log On
Keep_Log Off
K8S-Logging.Parser On
K8S-Logging.Exclude On
Kube_Tag_Prefix logs_kube.var.log.containers.
Buffer_Size 512KB
[FILTER]
Name lua
Match logs_*
Script timestamp.lua
Call set_timestamp
[FILTER]
Name rewrite_tag
Match logs_kube.*
Rule $kubernetes['pod_name'] (.*) logs_k8s.$kubernetes['namespace_name'].$0/$kubernetes['container_name'].$record_date.log false
Emitter_Name pod_tag
Emitter_Mem_Buf_Limit 50MB
[FILTER]
Name rewrite_tag
Match logs_host.*
Rule $_PID (.*) logs_kubelet.service/kubelet.$record_date.log false
Emitter_Name kubelet_tag
Emitter_Mem_Buf_Limit 50MB
[FILTER]
Name nest
Match logs_k8s.*
Operation lift
Nested_under kubernetes
Add_prefix k8s_
[FILTER]
Name nest
Match logs_k8s.*
Operation lift
Nested_under k8s_labels
Add_prefix k8s_
[FILTER]
Name nest
Match logs_k8s.*
Operation lift
Nested_under k8s_annotations
Add_prefix k8s_
[FILTER]
Name record_modifier
Match logs_k8s.*
Whitelist_key k8s_pod_name
Whitelist_key k8s_namespace_name
Whitelist_key k8s_pod_id
Whitelist_key k8s_host
Whitelist_key k8s_app
Whitelist_key k8s_container_name
Whitelist_key k8s_docker_id
Whitelist_key k8s_container_hash
Whitelist_key k8s_container_image
Whitelist_key k8s_app.k8s.io/component
Whitelist_key k8s_app.kubernetes.io/instance
Whitelist_key k8s_app.kubernetes.io/managed-by
Whitelist_key k8s_app.kubernetes.io/name
Whitelist_key k8s_app.kubernetes.io/part-of
Whitelist_key k8s_helm.sh/chart
Whitelist_key k8s_cni.projectcalico.org/containerID
Whitelist_key k8s_cni.projectcalico.org/podIP
Whitelist_key k8s_cni.projectcalico.org/podIPs
Whitelist_key k8s_kubectl.kubernetes.io/restartedAt
Whitelist_key log
[OUTPUT]
Name file
Match logs_k8s.*
Mkdir True
Format template
Template {log}
Path /logs/retained-logs
[OUTPUT]
Name file
Match logs_kubelet.*
Mkdir True
Format template
Template {MESSAGE}
Path /logs/retained-logs
[OUTPUT]
Name forward
Match logs_*
Host ${FLUENTD_HOST}
Port ${FLUENTD_PORT}
Syslog-ng is used to forward the logs. It is a systemd process.
Configuration of syslog-ng (cat /etc/syslog-ng/syslog-ng.conf)
source src_local { systemd-journal();};
destination dst_remote_0 { network("<network-name>" transport(udp) port(514) ip-protocol(4)); };
log { source(src_local); destination(dst_remote_0); };
Syslog-ng is used to forward the logs. It is a systemd process.
Configuration of syslog-ng (cat /etc/syslog-ng/syslog-ng.conf)
source src_local { systemd-journal();};
destination dst_remote_0 { network("<network-name>" transport(udp) port(514) ip-protocol(4)); };
kubectl get cm -n tanzu-system-logging fluent-bit-config -o yaml