Commit d2e21ad4 authored by Ophélie Gagnard's avatar Ophélie Gagnard

src: Fixup 2b294bb3

parent 2b294bb3
......@@ -4,7 +4,6 @@ import (
"bytes"
"C"
"fmt"
"time"
"os"
"unsafe"
"net/http"
......@@ -45,7 +44,6 @@ func FLBPluginInit(plugin unsafe.Pointer) int {
//export FLBPluginFlushCtx
func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int {
var ret int
var ts interface{}
var record map[interface{}]interface{}
// Create Fluent Bit decoder
dec := output.NewDecoder(data, int(length))
......@@ -56,22 +54,11 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
var is_end bool = false
for {
// Extract Record
ret, ts, record = output.GetRecord(dec)
ret, _, record = output.GetRecord(dec)
if ret != 0 {
break
}
var timestamp time.Time
switch t := ts.(type) {
case output.FLBTime:
timestamp = ts.(output.FLBTime).Time
case uint64:
timestamp = time.Unix(int64(t), 0)
default:
fmt.Println("time provided invalid, defaulting to now.")
timestamp = time.Now()
}
// Print record keys and values
for _, v := range record {
var output_string string = ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment