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

src: Fixup 2b294bb3

parent 2b294bb3
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"C" "C"
"fmt" "fmt"
"time"
"os" "os"
"unsafe" "unsafe"
"net/http" "net/http"
...@@ -45,7 +44,6 @@ func FLBPluginInit(plugin unsafe.Pointer) int { ...@@ -45,7 +44,6 @@ func FLBPluginInit(plugin unsafe.Pointer) int {
//export FLBPluginFlushCtx //export FLBPluginFlushCtx
func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int { func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int {
var ret int var ret int
var ts interface{}
var record map[interface{}]interface{} var record map[interface{}]interface{}
// Create Fluent Bit decoder // Create Fluent Bit decoder
dec := output.NewDecoder(data, int(length)) dec := output.NewDecoder(data, int(length))
...@@ -56,22 +54,11 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int ...@@ -56,22 +54,11 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
var is_end bool = false var is_end bool = false
for { for {
// Extract Record // Extract Record
ret, ts, record = output.GetRecord(dec) ret, _, record = output.GetRecord(dec)
if ret != 0 { if ret != 0 {
break 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 // Print record keys and values
for _, v := range record { for _, v := range record {
var output_string string = "" 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