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

[filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here

Open huanggze opened this issue 7 years ago • 8 comments

Bug Report

Describe the bug

Some container logs were not received by ElasticSearch (for example, fluent-bit logs at least). And Fluent Bit produces the following warns:

[2019/11/05 02:52:03] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:05] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:05] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:27] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:27] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:34] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:34] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:34] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:34] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:35] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:52:35] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:53:02] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here
[2019/11/05 02:53:02] [ warn] [filter_nest] Value of key 'kubernetes' is not a map. Will not attempt to lift from here

To Reproduce

  • Rubular link if applicable:
  • Example log message if applicable:
{"log":"YOUR LOG MESSAGE HERE","stream":"stdout","time":"2018-06-11T14:37:30.681701731Z"}
  • Steps to reproduce the problem:

Expected behavior

I expect fluent-bit successfully forward my container logs to elasticsearch output successfully without missing a record and no warn message spams

Screenshots

Your Environment

  • Version used: v1.3.2
  • Configuration:
  • Environment name and version (e.g. Kubernetes? What version?): v1.15.5
  • Server type and version:
  • Operating System and version: Linux 3.10.0
  • Filters and plugins:
[SERVICE]
    Flush     1
    Daemon     Off
    Log_Level     info
    Parsers_File     parsers.conf
[INPUT]
    Name     tail
    Path     /var/log/containers/*.log
    Parser     docker
    Tag     kube.*
    Refresh_Interval     5
    Mem_Buf_Limit     5MB
    Skip_Long_Lines     On
    DB     /tail-db/tail-containers-state.db
    DB.Sync     Normal
[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
[FILTER]
    Name     nest
    Match     kube.*
    Operation     lift
    Nested_under     kubernetes
    Prefix_with     kubernetes_
[FILTER]
    Name     modify
    Match     kube.*
    Remove     stream
[FILTER]
    Name     modify
    Match     kube.*
    Remove     kubernetes_labels
[FILTER]
    Name     modify
    Match     kube.*
    Remove     kubernetes_annotations
[FILTER]
    Name     modify
    Match     kube.*
    Remove     kubernetes_pod_id
[FILTER]
    Name     nest
    Match     kube.*
    Operation     nest
    Wildcard     kubernetes_*
    Nested_under     kubernetes
    Remove_prefix     kubernetes_
[OUTPUT]
    Name     es
    Match     kube.*
    Host     elasticsearch-logging-data.kubesphere-logging-system.svc
    Port     9200
    Logstash_Format     On
    Replace_Dots     on
    Retry_Limit     False
    Type     flb_type
    Time_Key     @timestamp
    Logstash_Prefix     ks-logstash-log

Additional context

huanggze avatar Nov 05 '19 03:11 huanggze

It seems I have a duplicate nest filter in my configuration. will check and see if I can close this issue

[FILTER]
    Name     nest
    Match     kube.*
    Operation     lift
    Nested_under     kubernetes
    Prefix_with     kubernetes_

huanggze avatar Nov 05 '19 06:11 huanggze

This problem still occurs. I corrected my configuration and updated in my commnet.

huanggze avatar Nov 07 '19 01:11 huanggze

This could be related to https://github.com/fluent/fluent-bit/issues/1691

kantica avatar Nov 13 '19 20:11 kantica

@huanggze can you explain how did you solve this?

theboyisno-1 avatar Aug 19 '21 07:08 theboyisno-1

Hi @huanggze ,I have the simillar problem My fluent-bit version is: fluent-bit:1.5.7-debug My Kubernetes version is: 1.19.0 My fluent-bit logs is about:

[2021/10/12 02:49:49] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:49] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here

My fluent-bit configMap is

...
    [FILTER]
        Name                nest
        Match               ayunw.kube.*
        Operation           lift
        Nested_under        log

    [FILTER]
        Name                nest
        Match               ayunw.kube.*
        Operation           lift
        Nested_under        kubernetes

    [FILTER]
        Name                modify
        Match               ayunw.kube.*
        Hard_rename         stream source
        Hard_rename         labels pod_labels
...

can you explain how did you solve this?Thanks very much.

sreayunw avatar Oct 12 '21 02:10 sreayunw

Hi @huanggze ,I have the simillar problem My fluent-bit version is: fluent-bit:1.5.7-debug My Kubernetes version is: 1.19.0 My fluent-bit logs is about:

[2021/10/12 02:49:49] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:49] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here
[2021/10/12 02:49:50] [ warn] [filter:nest:nest.2] Value of key 'log' is not a map. Will not attempt to lift from here

My fluent-bit configMap is

...
    [FILTER]
        Name                nest
        Match               ayunw.kube.*
        Operation           lift
        Nested_under        log

    [FILTER]
        Name                nest
        Match               ayunw.kube.*
        Operation           lift
        Nested_under        kubernetes

    [FILTER]
        Name                modify
        Match               ayunw.kube.*
        Hard_rename         stream source
        Hard_rename         labels pod_labels
...

can you explain how did you solve this?Thanks very much.

@AlyssaBetty I have the same problem now, did you get any answer?

Huweicai avatar Oct 17 '21 10:10 Huweicai

@Huweicai ,Sorry, I've got no answer about this problem,and I haven't solve this problem too.If you get any answer or solved this problem,Please let me know。Thnks very much!

sreayunw avatar Oct 18 '21 01:10 sreayunw

@AlyssaBetty I solved this by modifying the docker parser parameter, because we need to parse the item 'log' into json before lift, so it's can be a valid map, this is my simplified configuration, hope this helps, it works in my environment:

  • kubernetes 1.21.5
  • fluent-bit 1.17
  • docker 20.10.8
[INPUT]
        Name              tail
        Tag               kube.*
        Path              /var/log/containers/*_nf-core_*.log
        Parser            docker
        DB                /var/log/flb_kube.db
        Mem_Buf_Limit     5MB
        Skip_Long_Lines   On
        Refresh_Interval  10

[PARSER]
        Name         docker
        Format       json
        Time_Key     time
        Time_Format %Y-%m-%dT%H:%M:%S.%L
        Time_Keep    On
        # Command      |  Decoder | Field | Optional Action, this is the most critical parameter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        Decode_Field_As    json        log

[FILTER]
        Name nest
        Match *
        Operation lift
        Nested_under log

Huweicai avatar Oct 18 '21 03:10 Huweicai