Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logcli query --tail incorrectly handles --since/--from #3269

Closed
chancez opened this issue Jan 29, 2021 · 0 comments · Fixed by #3270
Closed

Logcli query --tail incorrectly handles --since/--from #3269

chancez opened this issue Jan 29, 2021 · 0 comments · Fixed by #3270

Comments

@chancez
Copy link
Contributor

chancez commented Jan 29, 2021

Describe the bug
Logcli incorrectly sets the wrong query parameter for specifying the start time of a tail query, making --since/--from ineffective.

To Reproduce

~/p/loki(⎈ |dev-2447-us-west-2:monitoring) czibolski ❯❯❯ logcli --addr=https://loki.example.com query --no-labels '{doesnt="matter"}' --since 1s --tail                                                                                                                               master ✭ ✱ ◼
2021-01-29 12:23:13.546125 I | proto: duplicate proto type registered: ingester.Series
wss://loki.example.com/loki/api/v1/tail?delay_for=0&from=1611951792546900000&limit=30&query=%7Bdoesnt%3D%22matter%22%7D

Notice the query param from is used. It should be start according the API docs https://grafana.com/docs/loki/latest/api/#get-lokiapiv1tail.

This results in all logcli query --tail requests to default to showing the last 1 hour of logs.

Expected behavior
Logcli sets the start query parameter instead, properly filtering the logs based on the --since/--from time.

Environment:

~/p/loki(⎈ |dev-2447-us-west-2:monitoring) czibolski ❯❯❯ logcli --version                                                                                                                                                                                                                   master ✭ ✱ ◼
2021-01-29 12:26:20.504350 I | proto: duplicate proto type registered: ingester.Series
logcli, version 2.1.0 (branch: HEAD, revision: 1b79df37)
  build user:       root@b8941a81fe55
  build date:       2020-12-24T14:08:17Z
  go version:       go1.15.3
  platform:         darwin/amd64
cyriltovena pushed a commit to cyriltovena/loki that referenced this issue Jun 11, 2021
…rafana#3269)

* Split List and Load methods in the RuleStore.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Added tests for rule store loading.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* CHANGELOG.md

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Fix compilation errors.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Make sure to load listed rules.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Fix rule groups.
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Fixed compilation error.
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Review feedback.
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant