From 4d5b8476823f3032627e1d3e21fd3a1c3faf6efa Mon Sep 17 00:00:00 2001 From: Feroze Mohideen Date: Tue, 3 Oct 2023 14:29:24 -0400 Subject: [PATCH] add depl target id to log label match (#3720) --- api/server/handlers/porter_app/logs_apply_v2.go | 3 +++ api/server/handlers/porter_app/stream_logs.go | 1 + 2 files changed, 4 insertions(+) diff --git a/api/server/handlers/porter_app/logs_apply_v2.go b/api/server/handlers/porter_app/logs_apply_v2.go index 4f6e63ea7d..88f79dfc4a 100644 --- a/api/server/handlers/porter_app/logs_apply_v2.go +++ b/api/server/handlers/porter_app/logs_apply_v2.go @@ -55,6 +55,7 @@ const ( lokiLabel_PorterAppName = "porter_run_app_name" lokiLabel_PorterServiceName = "porter_run_service_name" lokiLabel_PorterAppRevisionID = "porter_run_app_revision_id" + lokiLabel_DeploymentTargetId = "porter_run_deployment_target_id" lokiLabel_Namespace = "namespace" ) @@ -158,6 +159,8 @@ func (c *AppLogsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { matchLabels[lokiLabel_PorterAppRevisionID] = request.AppRevisionID } + matchLabels[lokiLabel_DeploymentTargetId] = request.DeploymentTargetID + logRequest := &types.LogRequest{ Limit: request.Limit, StartRange: &request.StartRange, diff --git a/api/server/handlers/porter_app/stream_logs.go b/api/server/handlers/porter_app/stream_logs.go index 03dc5c4f11..9ccf19887b 100644 --- a/api/server/handlers/porter_app/stream_logs.go +++ b/api/server/handlers/porter_app/stream_logs.go @@ -127,6 +127,7 @@ func (c *StreamLogsLokiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request labels := []string{ fmt.Sprintf("%s=%s", lokiLabel_Namespace, namespace), fmt.Sprintf("%s=%s", lokiLabel_PorterAppName, request.AppName), + fmt.Sprintf("%s=%s", lokiLabel_DeploymentTargetId, request.DeploymentTargetID), } if request.ServiceName != "all" {