From f009c2dcddc238f5929f892d887ec60f7699357c Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Fri, 18 Jul 2025 07:29:39 -0700 Subject: [PATCH] CloudWatch: Handle log alerts queries where the time field is not the first field (#108277) CloudWatch: handle log alerts queries where the time field is not the first field --- pkg/tsdb/cloudwatch/log_query.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/tsdb/cloudwatch/log_query.go b/pkg/tsdb/cloudwatch/log_query.go index 1867cfa2fca..43237bece10 100644 --- a/pkg/tsdb/cloudwatch/log_query.go +++ b/pkg/tsdb/cloudwatch/log_query.go @@ -202,8 +202,12 @@ func groupResults(results *data.Frame, groupingFieldNames []string, fromSyncQuer groupLabels := generateLabels(groupingFields, i) // set the group key as the display name for sync queries - for j := 1; j < len(newFrame.Fields); j++ { + for j := 0; j < len(newFrame.Fields); j++ { valueField := newFrame.Fields[j] + // the time field might not be the first field so we check it here and skip the field if it is + if valueField.Type().Time() { + continue + } if valueField.Config == nil { valueField.Config = &data.FieldConfig{} }