Commit 7c3f032c authored by Xiaowu Zhang's avatar Xiaowu Zhang

check output

parent cbad0852
......@@ -50,6 +50,7 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
// Iterate Records
var result string
result = ""
var is_end bool = false
for {
// Extract Record
ret, ts, record = output.GetRecord(dec)
......@@ -72,10 +73,14 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
result = result + C.GoString(tag) + ":" +timestamp.String()
for _, v := range record {
result += "["
var output_string string = ""
for _, s := range v.([]uint8) {
result = result + string(s)
output_string = output_string + string(s)
}
result += "]"
if output_string == "fluentbit_end" {
is_end = true
}
result = result + output_string + "]"
}
result += "\n"
}
......@@ -88,7 +93,6 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
//body result
// content type "application/octet-stream"
//
fmt.Println(result)
var b = []byte(result)
uri := fmt.Sprintf("%s/ingest?reference=#%s", dict["streamtool_uri"], C.GoString(tag))
client := &http.Client{
......@@ -111,7 +115,9 @@ func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, tag *C.char) int
fmt.Printf("status code %d", rsp.StatusCode)
return output.FLB_RETRY
}
if is_end {
os.Exit(0)
}
return output.FLB_OK
}
......
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