<p>I am using fluent-bit version 1.4.6 and I am trying to collect logs from a tomcat/logs folder, but I receive:</p>
<p><code>[error] [input:tail:tail.0] read error, check permissions</code>
These files inside the logs folder are all &quot;rw-r-----&quot; (640).</p>
<p>I tried to confirm whether it can read it at all by changing the permissions of a file inside the logs folder and it works, but that does not solve the overall problem.</p>
<p>My question is, is this something that should be set on the tomcat level or it can be done via fluent-bit? Can I start that as a different user?</p>
<p>Thanks in advance!</p>

voidcraft
<p>You didn't specify 👀 how you deployed fluent-bit.</p>
<p>But yes you can run it as a different user specifying a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/" rel="nofollow noreferrer">SecurityContext</a> in Kubernetes.</p>
<p>For example:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluent-bit
  namespace: logging
  labels:
    k8s-app: fluent-bit-logging
    version: v1
    kubernetes.io/cluster-service: &quot;true&quot;
spec:
  selector:
    matchLabels:
      k8s-app: fluent-bit-logging
  template:
    metadata:
      labels:
        k8s-app: fluent-bit-logging
        version: v1
        kubernetes.io/cluster-service: &quot;true&quot;
      annotations:
        prometheus.io/scrape: &quot;true&quot;
        prometheus.io/port: &quot;2020&quot;
        prometheus.io/path: /api/v1/metrics/prometheus
    spec:
      securityContext:
        runAsUser: 1000 👈 user id that you want to run the containers in the pod as
      containers:
      - name: fluent-bit
        image: fluent/fluent-bit:1.3.11
        imagePullPolicy: Always
        ports:
          - containerPort: 2020
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
        - name: fluent-bit-config
          mountPath: /fluent-bit/etc/
        - name: mnt
          mountPath: /mnt
          readOnly: true
...
</code></pre>
<p>✌️</p>
