From 34cdf26d4086d4fa48595abe25bcb6786ac465e2 Mon Sep 17 00:00:00 2001 From: RRashmit Date: Tue, 24 Dec 2024 10:39:25 +0000 Subject: [PATCH 1/2] chore: updates the timezone to utc for tcplog receiver --- internal/collector/otel_collector_plugin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/collector/otel_collector_plugin.go b/internal/collector/otel_collector_plugin.go index 07f425236..068d4a612 100644 --- a/internal/collector/otel_collector_plugin.go +++ b/internal/collector/otel_collector_plugin.go @@ -33,8 +33,8 @@ const ( // 2024-11-06T17:19:24+00:00 ---> Nov 6 17:19:24 // 2024-11-16T17:19:24+00:00 ---> Nov 16 17:19:24 timestampConversionExpression = `'EXPR(let timestamp = split(split(body, ">")[1], " ")[0]; ` + - `let newTimestamp = timestamp matches "(\\d{4})-(\\d{2})-(0\\d{1})T(\\d{2}):(\\d{2}):(\\d{2}).*" ` + - `? date(timestamp).Format("Jan 2 15:04:05") : date(timestamp).Format("Jan 02 15:04:05"); ` + + `let newTimestamp = timestamp matches "(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})([+-]\\d{2}:\\d{2}|Z)" ` + + `? (let utcTime = date(timestamp).UTC(); utcTime.Format("Jan 2 15:04:05")) : date(timestamp).Format("Jan 02 15:04:05"); ` + `split(body, ">")[0] + ">" + newTimestamp + " " + split(body, " ", 2)[1])'` ) From 83d8bcc6b1553d790468a6a773b6d53cede961e0 Mon Sep 17 00:00:00 2001 From: RRashmit Date: Thu, 23 Jan 2025 10:11:41 +0000 Subject: [PATCH 2/2] chore: lint --- api/grpc/mpi/v1/command.pb.go | 2 +- api/grpc/mpi/v1/common.pb.go | 2 +- api/grpc/mpi/v1/files.pb.go | 2 +- internal/collector/otel_collector_plugin.go | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/grpc/mpi/v1/command.pb.go b/api/grpc/mpi/v1/command.pb.go index 7a29c30dd..b3cdd5cf1 100644 --- a/api/grpc/mpi/v1/command.pb.go +++ b/api/grpc/mpi/v1/command.pb.go @@ -8,7 +8,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.3 // protoc (unknown) // source: mpi/v1/command.proto diff --git a/api/grpc/mpi/v1/common.pb.go b/api/grpc/mpi/v1/common.pb.go index 493030c7d..d2cb5d35b 100644 --- a/api/grpc/mpi/v1/common.pb.go +++ b/api/grpc/mpi/v1/common.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.3 // protoc (unknown) // source: mpi/v1/common.proto diff --git a/api/grpc/mpi/v1/files.pb.go b/api/grpc/mpi/v1/files.pb.go index 38592679c..2cbfb57ec 100644 --- a/api/grpc/mpi/v1/files.pb.go +++ b/api/grpc/mpi/v1/files.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.0 +// protoc-gen-go v1.36.3 // protoc (unknown) // source: mpi/v1/files.proto diff --git a/internal/collector/otel_collector_plugin.go b/internal/collector/otel_collector_plugin.go index 068d4a612..dbdea6c6a 100644 --- a/internal/collector/otel_collector_plugin.go +++ b/internal/collector/otel_collector_plugin.go @@ -33,8 +33,10 @@ const ( // 2024-11-06T17:19:24+00:00 ---> Nov 6 17:19:24 // 2024-11-16T17:19:24+00:00 ---> Nov 16 17:19:24 timestampConversionExpression = `'EXPR(let timestamp = split(split(body, ">")[1], " ")[0]; ` + - `let newTimestamp = timestamp matches "(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})([+-]\\d{2}:\\d{2}|Z)" ` + - `? (let utcTime = date(timestamp).UTC(); utcTime.Format("Jan 2 15:04:05")) : date(timestamp).Format("Jan 02 15:04:05"); ` + + `let newTimestamp = ` + + `timestamp matches "(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})([+-]\\d{2}:\\d{2}|Z)" ` + + `? (let utcTime = ` + + `date(timestamp).UTC(); utcTime.Format("Jan 2 15:04:05")) : date(timestamp).Format("Jan 02 15:04:05"); ` + `split(body, ">")[0] + ">" + newTimestamp + " " + split(body, " ", 2)[1])'` )