Skip to content

Commit

Permalink
support Fluent Bit V2 metadata datetime (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
kruftik authored Sep 22, 2023
1 parent 34f7491 commit 5b0e9a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugin/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@ func toTime(raw interface{}) time.Time {
return typed.Time
case uint64:
return time.Unix(int64(typed), 0)
case []interface{}:
if dt, ok := typed[0].(output.FLBTime); ok {
return dt.Time
}
fmt.Printf("provided time (%+v) invalid: defaulting to now.\n", typed)
return time.Now()
default:
fmt.Println("time provided invalid, defaulting to now.")
fmt.Printf("provided time (%+v) invalid: defaulting to now.\n", typed)
return time.Now()
}
}
Expand Down

0 comments on commit 5b0e9a8

Please sign in to comment.