Compare commits

...

6 Commits

Author SHA1 Message Date
Michael Grote 9fb013d3a3 p 2023-11-28 16:28:53 +01:00
Michael Grote e834cf4d5c port 2023-11-28 16:25:53 +01:00
Michael Grote 27de245172 s 2023-11-28 16:24:44 +01:00
Michael Grote 211e0a6e77 d 2023-11-28 16:23:49 +01:00
Michael Grote 5a09933156 d 2023-11-28 16:18:06 +01:00
Michael Grote ecc9953a9f x 2023-11-28 16:15:58 +01:00
4 changed files with 93 additions and 1 deletions

View File

@ -0,0 +1,51 @@
version: '3.8'
services:
nginx-app:
container_name: nginx-app
image: nginx
labels:
logging: "promtail"
logging_jobname: "containerlogs"
ports:
- 8091:80
networks:
- app
grafana:
image: grafana/grafana:latest
ports:
- 3000:3000
volumes:
- ./grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yaml
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
networks:
- app
loki:
image: grafana/loki:latest
ports:
- 3100:3100
command: -config.file=/etc/loki/local-config.yaml
networks:
- app
promtail:
image: grafana/promtail:latest
container_name: promtail
volumes:
- ./promtail.yaml:/etc/promtail/docker-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
command: -config.file=/etc/promtail/docker-config.yaml
depends_on:
- loki
networks:
- app
networks:
app:
name: app

View File

@ -0,0 +1,10 @@
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
url: http://loki:3100
version: 1
editable: false
isDefault: true

View File

@ -0,0 +1,29 @@
# https://ruanbekker.medium.com/logging-with-docker-promtail-and-grafana-loki-d920fd790ca8
# https://grafana.com/docs/loki/latest/clients/promtail/configuration/
# https://docs.docker.com/engine/api/v1.41/#operation/ContainerList
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: flog_scrape
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 5s
#filters:
# - name: label
# values: ["logging=promtail"]
relabel_configs:
- source_labels: ['__meta_docker_container_name']
regex: '/(.*)'
target_label: 'container'
- source_labels: ['__meta_docker_container_log_stream']
target_label: 'logstream'
- source_labels: ['__meta_docker_container_label_logging_jobname']
target_label: 'job'

View File

@ -76,7 +76,9 @@ compose_files:
network: traefik
- name: statping-ng
state: present
- name: loki
state: present
### oefenweb.ufw
ufw_rules:
- rule: allow