fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

[error] [input:tail:tail.0] read error - Custom log path returns read permission issue even when the folder and the files within have read permissions.

Open berry2012 opened this issue 3 years ago • 9 comments

Custom log path returns read permission issue even when the folder and the files within have read permissions. I reproduced the same errors.

[root@ip-192-168-106-82 ~]# ls -l /opt/service_logs/customlogging
total 512
-rwxrwxrwx 1 root root 154347 Mar 28 17:56 1.log
-rwxrwxrwx 1 root root 172215 Mar 28 17:56 2.log

Fluent-bit configMap has two folders and one is a custom path.

data:
  application-log.conf: |
    [INPUT]
        Name                tail
        Tag                 application.*
        Exclude_Path        /var/log/containers/cloudwatch-agent*, /var/log/containers/fluent-bit*, /var/log/containers/aws-node*, /var/log/containers/kube-proxy*
        Path                /var/log/containers/*.log, /opt/service_logs/customlogging/*.log

Restarted the fluent-bit pods.

[2023/03/28 16:28:54] [error] [input:tail:tail.0] read error, check permissions: /opt/service_logs/customlogging/*.log
[2023/03/28 16:28:54] [ warn] [input:tail:tail.0] error scanning path: /opt/service_logs/customlogging/*.log
[2023/03/28 16:28:54] [error] [input:tail:tail.0] read error, check permissions: /opt/service_logs/customlogging/*.log
[2023/03/28 16:28:54] [ warn] [input:tail:tail.0] error scanning path: /opt/service_logs/customlogging/*.log

Also created Symbolic links to the default log path but still faced the error.

ls -l /var/log/containers
lrwxrwxrwx 1 root root  37 Mar 28 17:38 customlogging-1.log -> /opt/service_logs/customlogging/1.log
lrwxrwxrwx 1 root root  37 Mar 28 17:39 customlogging-2.log -> /opt/service_logs/customlogging/2.log

Originally posted by @berry2012 in https://github.com/fluent/fluent-bit/issues/5501#issuecomment-1488137656

berry2012 avatar Mar 29 '23 08:03 berry2012

Can you confirm it is still an issue on 2.0.10? The original issue was for 1.8 which has not been supported for a while.

Let's capture the full set up here as well, e.g. any SELinux interference, running in pods, etc.?

patrick-stephens avatar Mar 29 '23 09:03 patrick-stephens

Yes, still happening. Tested in the ffg:

  • 2.0.9
  • 1.9.10

To be sure it is not the case of folders not existing before fluent bit pods can scan the folders, I created the folder in all the nodes and also confirmed they exist on each node.

for pod in $(kg po | grep create | awk '{print $1}'); do k logs $pod; echo '-------'; done
ip-192-168-117-246.eu-west-1.compute.internal
total 8
drwxrwxrwx 2 root root    6 Apr  2 06:02 customlogging
-------
ip-192-168-156-77.eu-west-1.compute.internal
total 28
drwxrwxrwx 2 root root     6 Apr  2 06:02 customlogging
-------
ip-192-168-187-54.eu-west-1.compute.internal
total 0
drwxrwxrwx 2 root root 6 Apr  2 06:02 customlogging
-------
ip-192-168-128-198.eu-west-1.compute.internal
total 0
drwxrwxrwx 2 root root 6 Apr  2 06:02 customlogging
-------

Fluentbit pod

kg po fluent-bit-97pg8 -n amazon-cloudwatch -o yaml | grep securityContext -A4
      securityContext: {}
      serviceAccount: fluent-bit
      serviceAccountName: fluent-bit
      terminationGracePeriodSeconds: 10
      tolerations:

Pods that created the custom folder

kg daemonset customfolder  -o yaml | grep securityContext -A4 
--
        securityContext:
          privileged: true
        stdin: true
        stdinOnce: true
        terminationMessagePath: /dev/termination-log

Pod writing to custom location on the host

kg pod customlogging -o yaml | grep securityContext -A4
--
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:

Modified the permission of Fluentbit pod but still no difference

kg po fluent-bit-5z6pc -n amazon-cloudwatch -o yaml | grep securityContext -A4
--
    securityContext:
      privileged: true
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
--
  securityContext: {}
  serviceAccount: fluent-bit
  serviceAccountName: fluent-bit
  terminationGracePeriodSeconds: 10
  tolerations:

berry2012 avatar Apr 02 '23 06:04 berry2012

I am hitting the same error with the custom path.

[INPUT]
        Name              tail
        Tag               spark.<application_id>
        Path              /local1/events/*/*spark*
        DB                /var/log/flb_kube.db
        Parser            docker
        Docker_Mode       On
        Mem_Buf_Limit     5MB
        Skip_Long_Lines   On
        Refresh_Interval  10
        multiline.parser  docker, cri
        Tag_Regex         (?<application_id>.+)$

Error

[2023/04/03 22:48:09] [ warn] [input:tail:tail.1] error scanning path: /local1/events/*/*spark*
[2023/04/03 22:48:19] [error] [input:tail:tail.1] read error, check permissions: /local1/events/*/*spark*
[2023/04/03 22:48:19] [ warn] [input:tail:tail.1] error scanning path: /local1/events/*/*spark*
[2023/04/03 22:48:29] [error] [input:tail:tail.1] read error, check permissions: /local1/events/*/*spark*
[2023/04/03 22:48:29] [ warn] [input:tail:tail.1] error scanning path: /local1/events/*/*spark*

vara-bonthu avatar Apr 03 '23 23:04 vara-bonthu

+1 , I even notice if I create a volume in an nginx deployment I can see mount in /proc/mounts and able to cd in directory , now if I just change the image with fluent-bit image /proc/mounts its absent in the mounts, if that helps.

unmilb avatar Apr 11 '23 04:04 unmilb

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

github-actions[bot] avatar Jul 11 '23 02:07 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jul 16 '23 02:07 github-actions[bot]

@berry2012 were you able to fix this?

OsamaWohlig avatar Mar 07 '24 08:03 OsamaWohlig

I am still getting this issue. I have following mounts:

      volumes:
      - name: fluentbitstate
        hostPath:
          path: /var/fluent-bit/state
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: config-iag-fluentbit
        configMap:
          name: config-iag-fluentbit
      - name: runlogjournal
        hostPath:
          path: /run/log/journal
      - name: dmesg
  As i checked on the nodes, logs are not present at  /var/lib/docker/containers
  instead, logs can be found at /var/log/containers location
  should I change it to /var/log/containers?

bkrajendra avatar Jun 04 '24 10:06 bkrajendra

I am still getting this issue. I have following mounts:

      volumes:
      - name: fluentbitstate
        hostPath:
          path: /var/fluent-bit/state
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: config-iag-fluentbit
        configMap:
          name: config-iag-fluentbit
      - name: runlogjournal
        hostPath:
          path: /run/log/journal
      - name: dmesg
  As i checked on the nodes, logs are not present at  /var/lib/docker/containers
  instead, logs can be found at /var/log/containers location
  should I change it to /var/log/containers?

Yes you have to mount the right things and ensure you are then tailing the right things - also check for dangling symlinks in the container.

patrick-stephens avatar Jun 04 '24 12:06 patrick-stephens