Skip to content

Commit 149565b

Browse files
committed
output: Handle Fluent Bit V2 metadata format
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent b93d969 commit 149565b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

output/decoder.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,22 @@ func GetRecord(dec *FLBDecoder) (ret int, ts interface{}, rec map[interface{}]in
8282
return -2, 0, nil
8383
}
8484

85-
t := slice.Index(0).Interface()
85+
var t interface{}
86+
ts = slice.Index(0).Interface()
87+
switch ty := ts.(type) {
88+
case FLBTime:
89+
t = ty
90+
case uint64:
91+
t = ty
92+
case []interface{}: // for Fluent Bit V2 metadata type of format
93+
s := reflect.ValueOf(ty)
94+
if s.Kind() != reflect.Slice || s.Len() < 2 {
95+
return -4, 0, nil
96+
}
97+
t = s.Index(0).Interface()
98+
default:
99+
return -5, 0, nil
100+
}
86101
data := slice.Index(1)
87102

88103
map_data, ok := data.Interface().(map[interface{}]interface{})

0 commit comments

Comments
 (0)