Skip to main content

Promtail

Ingesting logs into Siglens using Promtail

1. Install Promtail

Install Promtail for Linux:

Debian and Ubuntu

Download and install the Promtail binary:

curl -O -L "https://github.com/grafana/loki/releases/download/v2.9.5/promtail-linux-amd64.zip"
sudo apt install unzip
unzip "promtail-linux-amd64.zip"
sudo chmod a+x "promtail-linux-amd64"
CentOS, Redhat, and Amazon Linux

Download and install the Promtail binary:

curl -O -L "https://github.com/grafana/loki/releases/download/v2.9.5/promtail-linux-amd64.zip"
sudo yum install unzip
unzip "promtail-linux-amd64.zip"
sudo chmod a+x "promtail-linux-amd64"

2. Configure Promtail

Download the sample events file using the following command:

curl -s -L https://github.com/siglens/pub-datasets/releases/download/v1.0.0/2kevents.json.tar.gz -o 2kevents.json.tar.gz && tar -xvf 2kevents.json.tar.gz

Create a config file:

promtail.yaml
server:
http_listen_port: 9080
grpc_listen_port: 0

positions:
filename: /tmp/positions.yaml

clients:
- url: http://localhost:8081/loki/api/v1/push
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log # Path to the log file

For more information on customizing your promtail.yaml file according to your logs, refer to the Promtail documentation.

3. Run Promtail

./promtail-linux-amd64 -config.file=promtail.yaml