Open source softwares - Grafana

Back to Course

Lesson Description

Lession - #738 Install Loki Binary and Start as a Service

Install Loki Binary and Start as a Service

Download and Install Loki Binary To keep this as basic as could be expected, we will introduce the Loki twofold as a help on our current Grafana server.

To check the most recent rendition of Grafana Loki, visit the Loki discharges page. https://github.com/grafana/loki/discharges/

cd /usr/local/bin

curl -O -L "https://github.com/grafana/loki/releases/download/v2.4.1/loki-linux-amd64.zip"

unzip "loki-linux-amd64.zip"

And allow the execute permission on the Loki binary

chmod a+x "loki-linux-amd64"

Create the Loki config

Now create the Loki config file.

sudo nano config-loki.yml

And add this text.

auth_enabled: false

  http_listen_port: 3100
  grpc_listen_port: 9096

  path_prefix: /tmp/loki
      chunks_directory: /tmp/loki/chunks
      rules_directory: /tmp/loki/rules
  replication_factor: 1
      store: inmemory

    - from: 2020-10-24T00:00:00.000Z
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
        prefix: index_
        period: 24h

  alertmanager_url: 'http://localhost:9093'

Configure Loki to run as a service

Presently we will design Loki to run as a help with the goal that it stays running behind the scenes. Make a client explicitly for the Loki administration

sudo useradd --system loki

Create a file called loki.service

sudo nano /etc/systemd/system/loki.service

Add the script and save

Description=Loki service

ExecStart=/usr/local/bin/loki-linux-amd64 -config.file /usr/local/bin/config-loki.yml


Now start and check the service is running.

sudo service loki start
sudo service loki status

We can now leave the new Loki service running.

If you ever need to stop the new Loki service, then type

sudo service loki stop
sudo service loki status

Configure Firewall

At the point when your Loki server is running, it very well might be available somewhat on port 3100. In the event that you just need localhost to have the option to associate, type

iptables -A INPUT -p tcp -s localhost --dport 3100 -j ACCEPT
iptables -A INPU

In the wake of impeding port 3100 for outer solicitations, you can confirm that neighborhood demand are as yet conceivable by utilizing,

curl ""

Additionally, Loki uncovered port 9096 for gRPC correspondences. This port may likewise be open across the web. To close it utilizing iptables, then, at that point, use,

iptables -A INPUT -p tcp -s  --dport 9096 -j ACCEPT
iptables -A INPUT -p tcp -s localhost --dport 9096 -j ACCEPT
iptables -A INPUT -p tcp --dport 9096 -j DROP
iptables -L

prometheus and grafana

Prometheus is a checking answer for putting away time series information like measurements. Grafana permits to imagine the information put away in Prometheus (and different sources>
. This example exhibits how to catch NServiceBus measurements, putting away these in Prometheus and picturing these measurements utilizing Grafana.