Currently there are five ways to try out Loki, in order from easier to hardest:
- Grafana Cloud: Hosted Logs
- Run Loki locally with Docker
- Use Helm to deploy on Kubernetes
- Build Loki from source
- Get inspired by our production setup
For the various ways to run promtail
, the tailing agent, see our Promtail documentation.
Grafana is offering hosted Loki as part of our broader Grafana Cloud platform. Learn more at grafana.com/loki.
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
There is a Helm chart to deploy Loki and Promtail to Kubernetes.
First, see the build from source section of the root readme.
Once Promtail is built, to run Promtail, use the following command:
$ ./promtail -config.file=./cmd/promtail/promtail-local-config.yaml
...
Grafana is Loki's UI. To query your logs you need to start Grafana as well:
$ docker run -ti -p 3000:3000 grafana/grafana:master
Grafana should now be available at http://localhost:3000/. Follow the steps for configuring the datasource in Grafana and set the URL field to http://host.docker.internal:3100
.
For instructions on how to use Loki, see our usage docs.
We run Loki on Kubernetes with the help of ksonnet. You can take a look at our production setup.
To learn more about ksonnet, check out its documentation.