---
version: "3"

services:
  cadvisor:
    image: google/cadvisor:latest
    entrypoint:
      - /usr/bin/cadvisor
      - -logtostderr
    restart: always
    ports:
      - 58081:8080
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    privileged:
      true
    networks:
      promtail-network:
        ipv4_address: 192.168.177.31

  promtail:
    image: grafana/promtail:latest
    restart: always
    entrypoint:
      - sh
      - -euc
      - |
        cat <<EOF > /tmp/config.yml
        clients:
        - url: http://10.10.19.106:3100/loki/api/v1/push
        positions:
          filename: /tmp/positions.yaml
        scrape_configs:
        - job_name: dev_xxx
          static_configs:
          - labels:
              project: product_xxx
              job: manager-gateway
              __path__: /data/xxx/logs/xxx-gateway/*log
              host: $host
          - labels:
              project: product_xxx
              job: xcloud-apiagent
              __path__: /data/xxx/logs/xxx-apiagent/*log
              host: $host
        server:
          grpc_listen_port: 0
          http_listen_port: 9080
        EOF
        /usr/bin/promtail -config.file=/tmp/config.yml
    volumes:
      - /data:/data:ro
    networks:
      promtail-network:
        ipv4_address: 192.168.177.63

networks:
  promtail-network:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.177.0/24
    name: promtail-network
最后修改:2023 年 11 月 06 日
如果觉得我的文章对你有用,请随意赞赏