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

Fluent-bit logs skip issue : scan_blog add(): dismissed

Open mitesh-devops opened this issue 5 years ago • 51 comments

I would request some help for following fluent-bit logs which is causing logs skip for our many apps.It works correctly for few hours of the restart of fluent-bit.

logs 1:

[2021/08/27 08:01:29] [debug] [input:tail:tail.0] scan_blog add(): dismissed: /var/log/containers/container-name-1627776000-g52f7_prod-apps_container-name-4e462ab4ec40adb0c42bece9c054e16466ba444afd1f0c2634be03e3b86613d1.log, inode 533287
[2021/08/27 08:01:29] [debug] [input:tail:tail.0] scan_blog add(): dismissed: /var/log/containers/container-name-1630049400-w2hdn_prod-apps_container-name-8cea19f5e062b0d9b267f5ac3db0f8d74b0e690c62c5448a8b6dd16c2df1195f.log, inode 1605932

frequency: around 15-20 entries every 5 minutes when container starts and after few hours, it's the only logs which fluentbit prints and all logs get stopped.

logs 2:

[2021/08/27 08:01:42] [ info] [input:tail:tail.0] inotify_fs_remove(): inode=1606300 watch_fd=26
[2021/08/27 08:01:42] [debug] [input:tail:tail.0] inode=1605129 events: IN_ATTRIB 
[2021/08/27 08:01:42] [debug] [input:tail:tail.0] inode=1605129 file has been deleted: /var/log/containers/container-name-1630049400-g7mr8_prod-apps_container-name-7fcddb34d4164fbca29a342c75430d5f30ba0fb14e1ccdd183dbac82ef70e784.log
[2021/08/27 08:01:42] [debug] [input:tail:tail.0] db: file deleted from database: /var/log/containers/container-name-1630049400-g7mr8_prod-apps_container-name-7fcddb34d4164fbca29a342c75430d5f30ba0fb14e1ccdd183dbac82ef70e784.log

frequency: very few times

log 3:

[2021/08/27 12:30:34] [debug] [socket] could not validate socket status for #146 (don't worry)
[2021/08/27 12:30:57] [debug] [socket] could not validate socket status for #49 (don't worry)

frequency: Sometimes only.

Rest of the logs looks normal and correctly gathering and writing to elasticsearch.

Cluster Information:

  1. kubernetes nodes with around 20 nodes with fluentd deamonset.
  2. Elasticsearch 5 master-slave nodes:
  3. master nodes:
  4. 28GB RAM(per node)
  5. CPU 3 core(per node)
  6. elasticsearch:7.9.2
  7. fluent-bit version: 1.7

Expected behaviour: It shouldn't skip logs and should work without restart after sometime.

fluent-bit.conf

apiVersion: v1
data:
  filter-kubernetes.conf: |
    [FILTER]
        Name                kubernetes
        Match               kube.*
        Kube_URL            https://kubernetes.default.svc:443
        Kube_CA_File        /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        Kube_Token_File     /var/run/secrets/kubernetes.io/serviceaccount/token
        Kube_Tag_Prefix     kube.var.log.containers.
        Merge_Log           Off
        Buffer_Size         0
        #Merge_Log_Key       log_processed
        K8S-Logging.Parser  On
        K8S-Logging.Exclude Off
  fluent-bit.conf: |
    [SERVICE]
        Flush         3
        #Grace         120
        Log_Level     debug
        Daemon        off
        Parsers_File  parsers.conf
        #storage.path  /var/log/flb-storage/
        #storage.sync  normal
        #storage.checksum off
        #storage.backlog.mem_limit 20M
        HTTP_Server   On
        HTTP_Listen   0.0.0.0
        HTTP_Port     2020

    @INCLUDE input-kubernetes.conf
    @INCLUDE filter-kubernetes.conf
    @INCLUDE output-elasticsearch.conf
  input-kubernetes.conf: |
    [INPUT]
        Name              tail
        Tag               kube.*
        Path              /var/log/containers/*.log
        Exclude_Path      /var/log/containers/*_kube-system_*.log,/var/log/containers/*_log_*.log,/var/log/containers/*_mog_*.log,/var/log/containers/*_pd_*.log,/var/log/containers/*_kubecost_*.log,/var/log/containers/*_elastic-system_*.log,/var/log/containers/*_istio-*.log,/var/log/containers/*_cs_*.log,/var/log/containers/*_kube-public_*.log,/var/log/containers/*_ss_*.log
        Parser            docker
        DB                /var/log/flb_kube.db
        Mem_Buf_Limit     512MB
        Skip_Long_Lines   On
        Refresh_Interval  10
        # Control the log line length
        Buffer_Chunk_Size 10MB
        Buffer_Max_Size   40MB
        # Using the docker mode to deal with multiline messages emitted by docker
        Docker_Mode       On
        #storage.type      filesystem
        Rotate_Wait      30
  output-elasticsearch.conf: |
    [OUTPUT]
        Name            es
        Match           *
        Host            ${FLUENT_ELASTICSEARCH_HOST}
        Port            ${FLUENT_ELASTICSEARCH_PORT}
        HTTP_User       ${FLUENT_ELASTICSEARCH_USER}
        HTTP_Passwd     ${FLUENT_ELASTICSEARCH_PASSWORD}
        Logstash_Format On
        Logstash_Prefix newprod
        Replace_Dots    On
        Retry_Limit     False
        tls             On
        tls.verify      Off
  parsers.conf: |
    [PARSER]
        Name   apache
        Format regex
        Regex  ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
        Time_Key time
        Time_Format %d/%b/%Y:%H:%M:%S %z

    [PARSER]
        Name   apache2
        Format regex
        Regex  ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
        Time_Key time
        Time_Format %d/%b/%Y:%H:%M:%S %z

    [PARSER]
        Name   apache_error
        Format regex
        Regex  ^\[[^ ]* (?<time>[^\]]*)\] \[(?<level>[^\]]*)\](?: \[pid (?<pid>[^\]]*)\])?( \[client (?<client>[^\]]*)\])? (?<message>.*)$

    [PARSER]
        Name   nginx
        Format regex
        Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
        Time_Key time
        Time_Format %d/%b/%Y:%H:%M:%S %z

    [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]
        # http://rubular.com/r/tjUt3Awgg4
        Name cri
        Format regex
        Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>.*)$
        Time_Key    time
        Time_Format %Y-%m-%dT%H:%M:%S.%L%z

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

fluent-bit.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  annotations:
  labels:
    k8s-app: fluent-bit-logging
    kubernetes.io/cluster-service: "true"
    version: v1
  name: fluent-bit
  namespace: logging
spec:
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s-app: fluent-bit-logging
  template:
    metadata:
      annotations:
        prometheus.io/path: /api/v1/metrics/prometheus
        prometheus.io/port: "2020"
        prometheus.io/scrape: "true"
      labels:
        k8s-app: fluent-bit-logging
        kubernetes.io/cluster-service: "true"
        version: v1
    spec:
      containers:
      - env:
        - name: FLUENT_ELASTICSEARCH_HOST
          value: ******
        - name: FLUENT_ELASTICSEARCH_PORT
          value: "9200"
        - name: FLUENT_ELASTICSEARCH_USER
          value: *******
        - name: FLUENT_ELASTICSEARCH_PASSWORD
          value: ********
        - name: FLUENT_ELASTICSEARCH_SCHEME
          value: https
        image: fluent/fluent-bit:1.7
        imagePullPolicy: Always
        name: fluent-bit
        ports:
        - containerPort: 2020
          protocol: TCP
        resources:
          requests:
            cpu: 250m
            memory: 750Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/log
          name: varlog
        - mountPath: /var/lib/docker/containers
          name: varlibdockercontainers
          readOnly: true
        - mountPath: /fluent-bit/etc/
          name: fluent-bit-config
      nodeSelector:
        logging: "true"
      restartPolicy: Always
      securityContext: {}
      serviceAccount: fluent-bit
      serviceAccountName: fluent-bit
      terminationGracePeriodSeconds: 10
      volumes:
      - hostPath:
          path: /var/log
          type: ""
        name: varlog
      - hostPath:
          path: /var/lib/docker/containers
          type: ""
        name: varlibdockercontainers
      - configMap:
          defaultMode: 420
          name: fluent-bit-config
        name: fluent-bit-config

mitesh-devops avatar Aug 27 '21 13:08 mitesh-devops

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 27 '21 01:09 github-actions[bot]

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

github-actions[bot] avatar Oct 03 '21 01:10 github-actions[bot]

Hi @mitesh-devops, were you able to solve this issue? I'm facing the same, see #4155

rguske avatar Nov 09 '21 10:11 rguske

Same here.

kc-dot-io avatar Dec 07 '21 17:12 kc-dot-io

same here

soanni avatar Dec 08 '21 18:12 soanni

Hi, Actually, it was more issue of the output plugin. In my case, output pluging was Elasticsearch so sizing the shards correctly and including rollover ILM policies helped me to get this fixed. Also, try adding more RAM to diagnose.

mitesh-devops avatar Dec 21 '21 13:12 mitesh-devops

any solution regrading this ?

joebatish avatar Jan 16 '22 14:01 joebatish

@kc-dot-io Did you find solution for this ?

joebatish avatar Jan 16 '22 14:01 joebatish

I had same issue. But I think, may be I found which is main factor. I think Refresh_Interval, Buffer_Max_Size and Buffer_Chunk_Size is key-factor. I fixed this configuration after then there are not exist same error.

tr2vil avatar Mar 08 '22 02:03 tr2vil

Has this been resolved? This seems to be related to not removal of inode during file removal process i.e. (the inode entry not being removed from files_static, files_event[https://github.com/fluent/fluent-bit/blob/master/plugins/in_tail/tail_config.h#L129, https://github.com/fluent/fluent-bit/blob/master/plugins/in_tail/tail_file.c#1108])

ankitkr avatar Mar 10 '22 13:03 ankitkr

Hi all, it finally worked for our project after replacing Docker with Containerd and by applying the following config: https://github.com/vmware-samples/vcenter-event-broker-appliance/tree/development/files/configs/fluentbit/templates

https://github.com/fluent/fluent-bit/issues/4155#issuecomment-1046239927

rguske avatar Mar 10 '22 14:03 rguske

There is a bug in v1.8.13, we have just published the new container image for v1.8.14, please upgrade:

fluent/fluent-bit:1.8.14

edsiper avatar Mar 17 '22 23:03 edsiper

Same here (v1.9.1)

olastor avatar Apr 01 '22 17:04 olastor

Still having the issue with v1.9.2 too. any fix soon?

Lord-Y avatar Apr 22 '22 14:04 Lord-Y

Same in 1.9.3

maiconbaum avatar May 12 '22 04:05 maiconbaum

Same issue guys

ahvahsky2008 avatar May 26 '22 19:05 ahvahsky2008

Same in v1.9.3

kaleyroy avatar Jun 01 '22 08:06 kaleyroy

image

kaleyroy avatar Jun 01 '22 09:06 kaleyroy

Same in 1.9.4

RayMeibergen avatar Jun 20 '22 09:06 RayMeibergen

Any resolution for this, processes a few logs then falls over ? Docker image: fluent/fluent-bit:1.9.3-debug

CallumDowling avatar Jul 11 '22 03:07 CallumDowling