Used tech stack:
- Nginx - for proxying requests to 3100 port and a restricting access to this port by certain ip
- Promtail - logs collector
- Loki - sends logs to your general grafana loki server
- Copy
docker-compose.yml.example
todocker-compose.yml
- In docker-compose.yml in
promtail
service in volume block add needed folders with logs - Copy file
promtail-config/promtail.yaml.example
topromtail-config/promtail.yaml
- Add needed log folders to new jobs to
promtail-config/promtail.yaml
. Example:
- job_name: nginx
static_configs:
- targets:
- localhost
labels:
job: nginx
__path__: /var/www/nginx-proxy-hs1/log/nginx/*log
host: grafana
- Copy
nginx-config/default.nginx.conf.example
tonginx-config/default.nginx.conf
- If you want to restrict access for all IP except of sertain Grafana Loki server, unkomment and edit following code in
conf.d/default.nginx.conf
:
allow 192.168.176.1;
deny all;
http://ваш_сервер:3100/loki
- Switch to
promtail-loki-docker
folder - Run command
make up
- Switch to
promtail-loki-docker
folder - Run command
make down