Skip to content

Commit

Permalink
Fix handling of no labels flag in logcli when using live tailing
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepsukhani committed Aug 7, 2019
1 parent b36f680 commit 1d1c327
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/logcli/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -35,6 +36,7 @@ func tailQuery(out output.LogOutput) {
}

labels := ""
parsedLabels := promlabels.Labels{}
for _, stream := range tailReponse.Streams {
if !*noLabels {

Expand All @@ -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))
}

}
Expand Down

0 comments on commit 1d1c327

Please sign in to comment.