Skip to content

Commit

Permalink
fix(logcli): create new tail response for every line (#14525)
Browse files Browse the repository at this point in the history
When tailing with logcli, the loghttp.TailResponse is created outside of the loop, resulting in stale labels within the TailResponse LabelSet as the unmarshal does not clear the map.

Signed-off-by: Cyrill Troxler <[email protected]>
  • Loading branch information
ctrox authored Oct 18, 2024
1 parent 8ffd4da commit bcfd0d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/logcli/query/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func (q *Query) TailQuery(delayFor time.Duration, c client.Client, out output.Lo
log.Println("Print only labels key:", color.RedString(strings.Join(q.ShowLabelsKey, ",")))
}

tailResponse := new(loghttp.TailResponse)
lastReceivedTimestamp := q.Start

for {
tailResponse := new(loghttp.TailResponse)
err := unmarshal.ReadTailResponseJSON(tailResponse, conn)
if err != nil {
// Check if the websocket connection closed unexpectedly. If so, retry.
Expand Down

0 comments on commit bcfd0d1

Please sign in to comment.