官方文档采用Docker方式安装
官方文档地址:https://github.com/grafana/loki/tree/master/production
The Docker images for Loki and Promtail are available on DockerHub.
To test locally, we recommend using the docker-compose.yaml
file in this directory. Docker starts containers for Promtail, Loki, and Grafana.
-
Either
git clone
this repository locally andcd loki/production
, or download a copy of the docker-compose.yaml locally. -
Ensure you have the most up-to-date Docker container images:
docker-compose pull
-
Run the stack on your local Docker:
docker-compose up
-
Grafana should now be available at http://localhost:3000/. Log in with
admin
/admin
and follow the steps for configuring the datasource in Grafana, usinghttp://loki:3100
for the URL field.
Note: When running locally, Promtail starts before Loki is ready. This can lead to the error message "Data source connected, but no labels received." After a couple seconds, Promtail will forward all newly created log messages correctly. Until this is fixed we recommend building and running from source.
For instructions on how to query Loki, see our usage docs.
To deploy a cluster of loki locally, please refer to this doc