<p>I have a PersistentVolumeClaims(PVC) with ReadWriteMany (RWX) access mode. This PVC is clamed by 2 pods. In the second pod I have FluentBit reading the logs stored by the application pod in the shared PVC.<br />
<strong>The issue is FluentBit recognizes the files. FluentBit prints to the log that it found a new file.
But it does not read the content of new file as and how logs are inserted into the file.</strong><br />
<strong>I am using OpenShift 3.11, if that makes any difference. How do I share the PVC between pods?</strong></p>
<p>Logs from fluentBit console.</p>
<pre><code>Fluent Bit v1.7.9
* Copyright (C) 2019-2021 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io 

[2021/07/21 08:20:09] [ info] [engine] started (pid=1)
[2021/07/21 08:20:09] [ info] [storage] version=1.1.1, initializing...
[2021/07/21 08:20:09] [ info] [storage] in-memory
[2021/07/21 08:20:09] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2021/07/21 08:20:09] [ info] [http_server] listen iface=0.0.0.0 tcp_port=2020
[2021/07/21 08:20:09] [ info] [sp] stream processor started
[2021/07/21 08:20:09] [ info] [input:tail:tail.0] inotify_fs_add(): inode=97 watch_fd=1 name=/var/log/log-logging-poc-standalone-app-54d8467d6f-f9j5c-2021072011.json
[2021/07/21 08:20:09] [ info] [input:tail:tail.0] inotify_fs_add(): inode=54346 watch_fd=1 name=/var/log/log-logging-poc-standalone-app-54d8467d6f-f9j5c-2021072012.json
[2021/07/21 08:20:09] [ info] [input:tail:tail.0] inotify_fs_add(): inode=43255 watch_fd=1 name=/var/log/log-logging-poc-standalone-app-54d8467d6f-f9j5c-2021072013.json
</code></pre>
<p>First - Application pod claims this to store the application logs.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: logging-poc-standalone-app
spec:
  selector:
    matchLabels:
      app: logging-poc-standalone-app
  template:
    metadata:
      labels:
        app: logging-poc-standalone-app
    spec:
      containers:
      - name: logging-poc-standalone-app
        image: loggingpoc:dev
        resources:
          limits:
            memory: &quot;128Mi&quot;
            cpu: &quot;500m&quot;
        ports:
        - containerPort: 8080
        volumeMounts:
            - name: log-volume
              mountPath: /var/log/
      securityContext:
        supplementalGroups: [100003] 
        privileged: false
      volumes:
        - name: log-volume
          persistentVolumeClaim:
            claimName: data-3 

 
</code></pre>
<p>Second - FluentBit pod claims the same PVC in readOnly mode.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: fluent-bit
spec:
  selector:
    matchLabels:
      app: fluent-bit
  template:
    metadata:
      labels:
        app: fluent-bit
    spec:
      containers:
      - name: fluent-bit
        image: &quot;fluent/fluent-bit:1.7-debug&quot;
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            memory: &quot;200Mi&quot;
            cpu: &quot;500m&quot;
        ports:
        - name: matrices
          containerPort: 2020
          protocol: TCP
        volumeMounts:
          - name: log-volume
            mountPath: /var/log/
          - name: config-volume
            mountPath: /fluent-bit/etc/ 
      securityContext:
        supplementalGroups: [100003] 
        privileged: false
      volumes:
        - name: log-volume
          persistentVolumeClaim:
            claimName: data-3
            readOnly: true
        - name: config-volume
          configMap:
            name: flb-sidecar
</code></pre>
<p>Following is the fluentbit configuration -</p>
<pre><code>data:
  # Configuration files: server, input, filters and output
  # ======================================================
  fluent-bit.conf: |
    [SERVICE]
        Flush         5
        Log_Level     info
        Daemon        off
        Parsers_File  parsers.conf
        HTTP_Server   On
        HTTP_Listen   0.0.0.0
        HTTP_Port     2020

    [INPUT]
        Name                tail
        Tag                 demo.wen.api
        Parser              json
        Path                /var/log/log-*.json
        Mem_Buf_Limit       10MB
        Skip_Long_Lines     On
        Refresh_Interval    10

    [OUTPUT]
        Name stdout
        Match *

  parsers.conf: |
    [PARSER]
        Name   json
        Format json
        Time_Key time
        Time_Format %d/%b/%Y:%H:%M:%S %z

    [PARSER]
        Name        docker
        Format      json
        Time_Key    time
        Time_Format %Y-%m-%dT%H:%M:%S.%L
        Time_Keep   On

    [PARSER]
        Name        syslog
        Format      regex
        Regex       ^\&lt;(?&lt;pri&gt;[0-9]+)\&gt;(?&lt;time&gt;[^ ]* {1,2}[^ ]* [^ ]*) (?&lt;host&gt;[^ ]*) (?&lt;ident&gt;[a-zA-Z0-9_\/\.\-]*)(?:\[(?&lt;pid&gt;[0-9]+)\])?(?:[^\:]*\:)? *(?&lt;message&gt;.*)$
        Time_Key    time
        Time_Format %b %d %H:%M:%S
</code></pre>

Sunil
<p>I had the same issue. I was able to get this to work by turning off the <code>Inotify_Watcher</code> setting.</p>
<pre><code>    [INPUT]
        Name                tail
        Tag                 demo.wen.api
        Parser              json
        Path                /var/log/log-*.json
        Mem_Buf_Limit       10MB
        Skip_Long_Lines     On
        Refresh_Interval    10
        Inotify_Watcher     false
</code></pre>
<p><a href="https://docs.fluentbit.io/manual/pipeline/inputs/tail#:%7E:text=Configuration-,Parameters,-The%20plugin%20supports" rel="nofollow noreferrer">Fluent Bit Tail Parameters</a></p>
