You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Running tailing queries with logcli will append labels to log lines which are not present for this specific log line but from others which matches the query too.
Using the query without --tail (and adding --since) works correctly.
To Reproduce
Steps to reproduce the behavior:
Started Loki 2.7.3
Started LogCli 2.7.3 for tailing most logs logcli query --tail '{host=~ ".+"}'
Expected behavior
Each output line should contain the log line with the correct label set.
The cause is that somehow the same labels object keeps being appended to here. One way to solve the problem would be to start with an empty label set on each call, but I don't know if that has any side effects since this appears to be an intentional design decision.
ctrox
added a commit
to ctrox/loki
that referenced
this issue
Oct 18, 2024
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.
Fixesgrafana#8617
Signed-off-by: Cyrill Troxler <[email protected]>
Describe the bug
Running tailing queries with logcli will append labels to log lines which are not present for this specific log line but from others which matches the query too.
Using the query without --tail (and adding --since) works correctly.
To Reproduce
Steps to reproduce the behavior:
logcli query --tail '{host=~ ".+"}'
Expected behavior
Each output line should contain the log line with the correct label set.
Environment:
Screenshots, Promtail config, or terminal output
The following log line is wrong:
2023-02-24T09:14:28+01:00 {filename="/var/log/apache2/gitlab.SECRET.com_ssl_access.log", host="gitlab.SECRET.com", job="varlogs", nodename="stats", syslog_identifier="systemd", systemd_unit="php7.4-fpm.service"} 192.168.1.1 - - [24/Feb/2023:09:14:28 +0100] "POST /api/v4/jobs/request HTTP/1.1" 204 459 "-" "gitlab-runner 15.9.0 (15-9-stable; go1.18.10; linux/amd64)"
The correct one would be:
2023-02-24T09:14:28+01:00 {filename="/var/log/apache2/gitlab.SECRET.com_ssl_access.log", host="gitlab.SECRET.com", job="varlogs"} 192.168.1.1 - - [24/Feb/2023:09:14:28 +0100] "POST /api/v4/jobs/request HTTP/1.1" 204 459 "-" "gitlab-runner 15.9.0 (15-9-stable; go1.18.10; linux/amd64)"
The additional labels which get mixed in are also only valid for the label/value pair host="stats.SECRET.com".
The text was updated successfully, but these errors were encountered: