grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.85k stars 3.44k forks source link

Cannot install logcli #5419

Closed andig closed 2 years ago

andig commented 2 years ago

Describe the bug Install using Go according to https://grafana.com/docs/loki/latest/getting-started/logcli/ fails

To Reproduce

❯ go get github.com/grafana/loki/cmd/logcli@latest
Alias tip: gog github.com/grafana/loki/cmd/logcli@latest
github.com/grafana/loki/cmd/logcli imports
    github.com/grafana/loki/pkg/logcli/query imports
    github.com/grafana/loki/pkg/loki imports
    github.com/cortexproject/cortex/pkg/querier/frontend imports
    google.golang.org/grpc/naming: cannot find module providing package google.golang.org/grpc/naming
go: warning: github.com/gomodule/redigo@v2.0.0+incompatible: retracted by module author: Old development version not maintained or published.
go: warning: k8s.io/client-go@v12.0.0+incompatible: retracted by module author: pre-module versions are obsolete
go: to switch to the latest unretracted version, run:
    go get <module>@latest

Expected behavior No error

Environment: OSX

kavirajk commented 2 years ago

@andig This is because of @latest you used in go get. as Loki's sem version (say v2.4.2) is not same as Go's sem version. More details here.

But you can still use just logcli or logcli@<commit-hash> to install it.

bash: logcli: command not found
loki$ go get github.com/grafana/loki/cmd/logcli
go: downloading github.com/grafana/regexp v0.0.0-20220202152315-e74e38789280
go: downloading github.com/grafana/dskit v0.0.0-20220211095946-19921f863583
go: downloading github.com/MasslessParticle/azure-storage-blob-go v0.14.1-0.20220216145902-b5e698eff68e
go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf" module instead.
loki$ logcli
usage: logcli [<flags>] <command> [<args> ...]

A command-line for loki.

You are welcome to add this clarity on the doc and send PR :)

chaudum commented 2 years ago

The docs are already updated on main, it will be on the website with the next release (2.5) https://github.com/grafana/loki/pull/5126/files

bilbof commented 1 year ago

For anyone who hits this issue, the current working solution is:

require github.com/grafana/loki v1.6.2-0.20230331122723-edc6b0bff767

replace github.com/gocql/gocql => github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85