From e3ea9e0773ae4c47b93805ec178cde0a09cd694f Mon Sep 17 00:00:00 2001 From: sharkpc138 Date: Mon, 4 Nov 2024 15:11:42 +0900 Subject: [PATCH] Fix(exporter): fix parser to also parse the timestamp in a single log line --- pkg/lobster/sink/exporter/exporter.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/lobster/sink/exporter/exporter.go b/pkg/lobster/sink/exporter/exporter.go index a890891..6d9b4c0 100644 --- a/pkg/lobster/sink/exporter/exporter.go +++ b/pkg/lobster/sink/exporter/exporter.go @@ -35,6 +35,7 @@ import ( "github.com/naver/lobster/pkg/lobster/sink/order" "github.com/naver/lobster/pkg/lobster/store" "github.com/naver/lobster/pkg/lobster/util" + "github.com/pkg/errors" sinkV1 "github.com/naver/lobster/pkg/operator/api/v1" ) @@ -248,7 +249,12 @@ func parseStart(data []byte) (time.Time, error) { func parseEnd(data []byte) (time.Time, error) { index := bytes.LastIndexAny(data[:len(data)-2], "\n") if index < 0 { - return time.Time{}, fmt.Errorf("failed to parse end") + t, err := logline.ParseTimestamp(string(data)) + if err != nil { + return time.Time{}, errors.Wrap(err, "failed to parse end") + } + + return t, nil } return logline.ParseTimestamp(string(data[index+1:]))