From 1d1c327d038208084c4befadad4d1623d28716fb Mon Sep 17 00:00:00 2001 From: Sandeep Sukhani Date: Wed, 7 Aug 2019 16:03:55 +0530 Subject: [PATCH] Fix handling of no labels flag in logcli when using live tailing --- cmd/logcli/tail.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/logcli/tail.go b/cmd/logcli/tail.go index 5f8057c29e848..052da6d1d8875 100644 --- a/cmd/logcli/tail.go +++ b/cmd/logcli/tail.go @@ -9,6 +9,7 @@ import ( "github.com/grafana/loki/pkg/querier" "github.com/fatih/color" + promlabels "github.com/prometheus/prometheus/pkg/labels" ) func tailQuery(out output.LogOutput) { @@ -35,6 +36,7 @@ func tailQuery(out output.LogOutput) { } labels := "" + parsedLabels := promlabels.Labels{} for _, stream := range tailReponse.Streams { if !*noLabels { @@ -53,14 +55,13 @@ func tailQuery(out output.LogOutput) { labels = ls.String() } else { - labels = stream.Labels } + parsedLabels = mustParseLabels(labels) } for _, entry := range stream.Entries { - lbls := mustParseLabels(labels) - fmt.Println(out.Format(entry.Timestamp, &lbls, 0, entry.Line)) + fmt.Println(out.Format(entry.Timestamp, &parsedLabels, 0, entry.Line)) } }