cosmo0920 / fluent-bit-go-loki

[Deprecated] The predessor of fluent-bit output plugin for Loki. https://github.com/grafana/loki
Apache License 2.0
40 stars 6 forks source link

Support for msgpack #18

Closed rverma-nikiai closed 5 years ago

rverma-nikiai commented 5 years ago

Problem

Seems like msgpack json is not deserialized properly. ...

Steps to replicate

I have used sample fluent config as

  fluent-bit.conf: |
    [SERVICE]
        Flush         5
        Log_Level     warn
        Daemon        off
        Parsers_File  parsers.conf
        Streams_File  stream_processor.conf
        HTTP_Server   Off
        HTTP_Listen   0.0.0.0
        HTTP_Port     2020

    @INCLUDE tail-pods.conf
    @INCLUDE filter-kubernetes.conf
    @INCLUDE output-loki.conf
  tail-pods.conf: |
    [INPUT]
        Name              tail
        Tag               kube.*
        Path              /var/log/containers/*_app_*.log
        Parser            docker
        DB                /var/log/flb_kube_ns.db
        Mem_Buf_Limit     5MB
        Refresh_Interval  10
        Skip_Long_Lines   On
        Routable          Off
  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           On
        K8S-Logging.Parser  On
        K8S-Logging.Exclude Off
        Annotations         Off
  output-loki.conf: |
    [OUTPUT]
        Name      loki
        Match     app.*
        Url       http://distributor/api/prom/push
        BatchWait 10
        BatchSize 30
        LabelKeys kubernetes
  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
  stream_processor.conf: |
    [STREAM_TASK]
        Name   app.pypicloud
        Exec   CREATE STREAM results WITH (tag='app.pypicloud') AS SELECT * FROM TAG:'kube.*' WHERE kubernetes['labels']['app']='pypicloud';

While the labels in grafana looks like

{kubernetes="map[container_name:[112 121 112 105 99 108 111 117 100] docker_id:[56 52 97 97 55 54 48 56 55 101 52 56 56 53 55 48 57 54 53 50 55 52 97 48 99 54 50 52 101 52 50 102 99 97 101 102 56 56 50 98 51 102 50 101 57 100 97 100 56 53 56 101 54 51 98 52 99 98 51 57 102 50 50 51] host:[105 112 45 49 48 45 50 45 50 50 45 50 52 55 46 97 112 45 115 111 117 116 104 45 49 46 99 111 109 112 117 116 101 46 105 110 116 101 114 110 97 108] labels:map[app:[112 121 112 105 99 108 111 117 100] pod-template-hash:[100 100 52 54 56 55 56 98 52] release:[112 121 112 105 99 108 111 117 100]] namespace_name:[97 112 112] pod_id:[50 101 56 98 57 55 57 56 45 99 97 53 97 45 49 49 101 57 45 98 50 97 102 45 48 97 57 51 57 55 98 100 52 102 52 54] pod_name:[112 121 112 105 99 108 111 117 100 45 100 100 52 54 56 55 56 98 52 45 102 56 54 52 98]]"}

Expected Behavior or What you need to ask

Show actual labels.

Using Fluentd and loki plugin versions

EKS 1.13.8 Fluentbit 1.2.2 Latest mater build of the plugin. Loki 0.3.0 Grafana 6.2.5

cosmo0920 commented 5 years ago

fluent-bit-go-loki is merged into loki upstream. You can handle nested record in label with the following instruction: https://github.com/grafana/loki/tree/master/cmd/fluent-bit#labelmappath