diff --git a/promtail-agent/docker-compose.yml b/promtail-agent/docker-compose.yml new file mode 100644 index 0000000..b673e9e --- /dev/null +++ b/promtail-agent/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.8" + +services: + promtail: + image: grafana/promtail:latest + container_name: promtail + logging: + driver: journald + options: + mode: non-blocking + environment: + - TZ=America/Chicago + volumes: + - /opt/logs:/opt/logs:ro # docker + - /var/log:/var/log:ro # varlogs + - ./promtail:/etc/promtail + - /etc/machine-id:/etc/machine-id:ro # journald logging + restart: unless-stopped + command: -config.file=/etc/promtail/promtail-config.yml diff --git a/promtail-agent/promtail/promtail-config.yml b/promtail-agent/promtail/promtail-config.yml new file mode 100644 index 0000000..883b879 --- /dev/null +++ b/promtail-agent/promtail/promtail-config.yml @@ -0,0 +1,37 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://192.168.60.8:3100/loki/api/v1/push + +# local machine logs +scrape_configs: + - job_name: system + pipeline_stages: + - job_name: journal + journal: + max_age: 12h + labels: + job: systemd-journal + relabel_configs: + - source_labels: ["__journal__systemd_unit"] + target_label: "unit" + - source_labels: ["__journal_container_name"] + target_label: "container" + static_configs: + - targets: + - localhost + labels: + job: varlogs + __path__: /var/log/**/**log + - targets: + - localhost + labels: + job: containers + __path__: /opt/logs/**/*log # internal container logs + +