0

我的目标容器包含我想从 Elastic Fleet 的 NGINX 集成中收集的 NGINX 日志。

我遵循了每一步,甚至成功地将队列服务器和代理托管在两个单独的容器中,让我感到困惑的是,如何配置我的代理(其策略中包含 NGINX 集成设置)以从服务容器收集日志?

我经常遇到直接在目标容器上使用弹性代理作为包安装程序的示例。

我附上了我的 docker-compose 设置的三个片段,我遵循这些片段用于 Fleet、Agent 和 App 容器。

车队服务器

  fleet:
    image: docker.elastic.co/beats/elastic-agent:$ELASTIC_VERSION
    healthcheck:
      test: "curl -f http://127.0.0.1:8220/api/status | grep HEALTHY 2>&1 >/dev/null"
      retries: 12
      interval: 5s
    hostname: fleet
    container_name: fleet
    restart: always
    user: root
    environment:
    - FLEET_SERVER_ENABLE=1
    - "FLEET_SERVER_ELASTICSEARCH_HOST=https://elasticsearch:9200"
    - FLEET_SERVER_ELASTICSEARCH_USERNAME=elastic
    - FLEET_SERVER_ELASTICSEARCH_PASSWORD=REPLACE1
    - FLEET_SERVER_ELASTICSEARCH_CA=$CERTS_DIR/ca/ca.crt
    - FLEET_SERVER_INSECURE_HTTP=1
    - KIBANA_FLEET_SETUP=1
    - "KIBANA_FLEET_HOST=https://kibana:5601" 
    - KIBANA_FLEET_USERNAME=elastic
    - KIBANA_FLEET_PASSWORD=REPLACE1
    - KIBANA_FLEET_CA=$CERTS_DIR/ca/ca.crt
    - FLEET_ENROLL=1
    ports:
      - 8220:8220
    networks:
      - elastic
    volumes:
       - certs:$CERTS_DIR

弹力剂

agent:
    image: docker.elastic.co/beats/elastic-agent:$ELASTIC_VERSION
    container_name: agent
    hostname: agent
    restart: always
    user: root 
    healthcheck:
      test: "elastic-agent status"
      retries: 90
      interval: 1s
    environment:
      - FLEET_ENROLLMENT_TOKEN=REPLACE2
      - FLEET_ENROLL=1
      - FLEET_URL=http://fleet:8220
      - FLEET_INSECURE=1
      - ELASTICSEARCH_HOSTS='["https://elasticsearch:9200"]'
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=REPLACE1
      - ELASTICSEARCH_CA=$CERTS_DIR/ca/ca.crt
      - "STATE_PATH=/usr/share/elastic-agent"
    networks:
      - elastic
    volumes:
       - certs:$CERTS_DIR

应用容器(NGINX 日志)

  demo-app:
    image: ubuntu:bionic
    container_name: demo-app
    build:
      context: ./docker/
      dockerfile: Dockerfile
    volumes:
      - ./app:/var/www/html/app
      - ./docker/nginx.conf:/etc/nginx/nginx.conf
    ports:
      - target: 90
        published: 9090
        protocol: tcp
        mode: host
    networks:
      - elastic

ELK 堆栈当前在版本7.17.0上运行。如果有人可以提供有关下一步需要做什么的任何信息,那将非常有帮助,谢谢!

4

0 回答 0