Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/production
Edward Welch 5cf1dc51e4 Add another variable to pick the name of the promtail pod, we don't always deploy promtail with the same name and sometimes put more than one deployment in a namespace 6 years ago
..
helm [promtail helm chart] - Expand promtail syslog svc to support values (#1731) 6 years ago
ksonnet fix(ksonnet): named parameters for containerPort 6 years ago
loki-mixin breakout promtail mixin to be separate. 6 years ago
promtail-mixin Add another variable to pick the name of the promtail pod, we don't always deploy promtail with the same name and sometimes put more than one deployment in a namespace 6 years ago
README.md docs: fix broken promtail link 6 years ago
docker-compose.yaml Tag with lastest (#236) 7 years ago

README.md

Running Loki

Currently there are five ways to try out Loki, in order from easier to hardest:

For the various ways to run promtail, the tailing agent, see our Promtail documentation.

Grafana Cloud: Hosted Logs

Grafana is offering hosted Loki as part of our broader Grafana Cloud platform. Learn more at grafana.com/loki.

Run locally using Docker

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.

  1. Either git clone this repository locally and cd loki/production, or download a copy of the docker-compose.yaml locally.

  2. Ensure you have the most up-to-date Docker container images:

    docker-compose pull
    
  3. Run the stack on your local Docker:

    docker-compose up
    
  4. Grafana should now be available at http://localhost:3000/. Log in with admin / admin and follow the steps for configuring the datasource in Grafana, using http://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.

Using Helm to deploy on Kubernetes

There is a Helm chart to deploy Loki and Promtail to Kubernetes.

Build and run from source

Loki can be run in a single host, no-dependencies mode using the following commands.

You need go v1.10+ installed locally.


$ go get github.com/grafana/loki
$ cd $GOPATH/src/github.com/grafana/loki # GOPATH is $HOME/go by default.

$ go build ./cmd/loki
$ ./loki -config.file=./cmd/loki/loki-local-config.yaml
...

To build Promtail on non-Linux platforms, use the following command:

$ go build ./cmd/promtail

On Linux, Promtail requires the systemd headers to be installed for Journal support.

With Journal support on Ubuntu, run with the following commands:

$ sudo apt install -y libsystemd-dev
$ go build ./cmd/promtail

With Journal support on CentOS, run with the following commands:

$ sudo yum install -y systemd-devel
$ go build ./cmd/promtail

Otherwise, to build Promtail without Journal support, run go build with CGO disabled:

$ CGO_ENABLED=0 go build ./cmd/promtail

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.

Get inspired by our production setup

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.