Giter VIP home page Giter VIP logo

fluent-bit-go-redis-output's Issues

createJSON function does not prevent base64 encoding

A function createJSON has a code which should handle base64 encoding of data but it does not work for all cases.

The function is located here:

func createJSON(timestamp time.Time, tag string, record map[interface{}]interface{}) (*logmessage, error) {
m := make(map[string]interface{})
// convert timestamp to RFC3339Nano which is logstash format
m["@timestamp"] = timestamp.UTC().Format(time.RFC3339Nano)
m["@tag"] = tag
for k, v := range record {
switch t := v.(type) {
case []byte:
// prevent encoding to base64
m[k.(string)] = string(t)
default:
m[k.(string)] = v
}
}
js, err := json.Marshal(m)
if err != nil {
return nil, fmt.Errorf("error creating message for REDIS: %v", err)
}
return &logmessage{data: js}, nil
}

But for example data:

	mapInterface := map[interface{}]interface{}{
		"annotations": map[interface{}]interface{}{
			"checksum/config": [13]int{111, 98, 115, 101, 114, 118, 97, 98, 105, 108, 105, 116, 121},
			"namespace_name":  [13]int{111, 98, 115, 101, 114, 118, 97, 98, 105, 108, 105, 116, 121},
		},
	}

it will produce base64 encoding in values for keys "checksum/config", "namespace_name".

Recursive call would be needed here.

Such cases will occur often, it is enough to enable fluent-bit kubernetes filter plugin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.