面对:流利的日志不可读。它被排除在外,下次将检查

我在kubernetes安装程序中运行的fluentD守护程序集有一个简单的配置。

流利版本: fluentd-0.12.43

下面是我的配置。

  <source>
    @type tail
    path /var/log/containers/sample*.log
    time_format %Y-%m-%dT%H:%M:%S.%NZ
    tag sample.*
    format json
    read_from_head true
  </source>
  <match sample.**>
    @type forward
    heartbeat_type tcp
    send_timeout 60s
    recover_wait 10s
    hard_timeout 60s
    <server>
      name worker-node2
      host 10.32.0.15
      port 24224
      weight 60
    </server>
  </match>

低于警告,不转发任何日志



日志文件的权限:
[root@k8s-master fluentd-daemonset]# ls -lrt **/var/log/containers/**

**lrwxrwxrwx** Jun 25 06:25 sample-77g68_kube-system_kube-proxy-9f3c3951c32ee.log
-> /var/log/pods/aa1f8d5b-746f-11e8-95c0-005056b9ff3a/sample/7.log

守护程序集的的YAML文件具有安装说明:
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: logging1
  labels:
    k8s-app: fluentd-logging
    version: v1
    kubernetes.io/cluster-service: "true"
spec:
  template:
    -----
    -----
    -----

        volumeMounts:
        - name: fluentd-config
          mountPath: /fluentd/etc/
        - name: varlog
          mountPath: /var/log
          readOnly: true
        - name: varlogpods
          mountPath: /var/log/pods
          readOnly: true
        - name: varlogcontainers
          mountPath: /var/log/containers
          readOnly: true
        - name: varlibdocker
          mountPath: /var/lib/docker
          readOnly: true
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: fluentd-config
        configMap:
          name: fluentd-config
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlogpods
        hostPath:
          path: /var/log/pods
      - name: varlogcontainers
        hostPath:
          path: /var/log/containers
      - name: varlibdocker
        hostPath:
          path: /var/lib/docker
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers

即使权限正确 fluentD版本正确挂载指令都在kubernetes守护程序中,他们仍然没有任何线索,为什么我收到此警告。

最佳答案

colachg的建议可以帮助您:

我认为kubelet在'/var/log/containers'中创建了一些符号链接(symbolic link)(只是链接不是真实文件),因此您必须同时安装链接和实际文件,或者仅使用正确的fluentd.conf安装实际文件。

关于logging - FluentD日志不可读。它被排除在外,下次将进行检查,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51671212/

10-11 06:44