Use Loggie to Collect Node Logs

In a Kubernetes cluster, in addition to collecting logs in Pods, there may also be some requirements for collecting kubelet logs and system logs on Node nodes.

Configuration

Different from the collecting container logs, node log collection needs to use the cluster-level ClusterLogConfig. Selector should be type: node and nodeSelector is used to select which nodes to deliver the configuration to. At the same time, ensure that these labels are included on the Node.

An example:

Example

  1. apiVersion: loggie.io/v1beta1
  2. kind: ClusterLogConfig
  3. metadata:
  4. name: varlog
  5. spec:
  6. selector:
  7. type: node
  8. nodeSelector:
  9. nodepool: demo
  10. pipeline:
  11. sources: |
  12. - type: file
  13. name: varlog
  14. paths:
  15. - /var/log/*.log
  16. sinkRef: default
  17. interceptorRef: default

In addition, it should be noted that if you need to collect logs of a certain path on the Node, you need to mount the same path in Loggie, otherwise, due to container isolation, Loggie cannot obtain the logs of the node. For example, to collect /var/log/logs on the Node, you need to add the Loggie Agent to mount the path.