configuring promtail as remote agent

Instructions on how to configure promtail remote agents (on remote servers)

Setup

setup instructions

install unzip

apt install -y unzip

setup dir

make dir to house promtail and it's config

mkdir /usr/local/bin/promtail

download & install promtail

find latest (stable) download link on the releases page and copy the url for the relevant version, then download and unzip it.

e.g. Ubuntu 18.04 we use promtail-linux-amd64/zip

cd /usr/local/bin/promtail
wget https://github.com/grafana/loki/releases/download/v1.6.1/promtail-linux-amd64.zip
unzip promtail-linux-amd64.zip
mv promtail-linux-amd64 promtail
rm promtail-linux-amd64.zip
chmod a+x promtail

create config

see reference config-promtail.yml and create similar config

vi config-promtail.yml

create promtail user & permissions

create the promtail user and add it to the relevant groups (e.g. groups where the promtail agent will read from)

useradd --system promtail
usermod -aG systemd-journal,adm,jitsi promtail

create promtail service

see reference promtail.service and create similar config

vi /etc/systemd/system/promtail.service

start promtail and verify it is stable

service promtail restart
service promtail status

successful response:

:root: [20-09-24 7:34:32] ➜  ~ service promtail status
● promtail.service - Promtail service
   Loaded: loaded (/etc/systemd/system/promtail.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-09-24 07:20:19 UTC; 14min ago
 Main PID: 6333 (promtail)
    Tasks: 10 (limit: 4680)
   CGroup: /system.slice/promtail.service
           └─6333 /usr/local/bin/promtail/promtail -config.file /usr/local/bin/promtail/config-promtail.yml

enable auto start on reboot

systemctl enable promtail.service

Links