千家信息网

docker efk搭建

发表于:2025-01-23 作者:千家信息网编辑
千家信息网最后更新 2025年01月23日,docker-compose.ymlversion: '3.7'services: elasticsearch: container_name: elasticsearch image:
千家信息网最后更新 2025年01月23日docker efk搭建

docker-compose.yml

version: '3.7'services:  elasticsearch:    container_name: elasticsearch    image: elasticsearch    ports:      - 9200:9200      - 9300:9300  fluentd:    container_name: fluentd    image: fluent/fluentd    volumes:      - ./fluentd/conf:/fluentd/etc    links:      - elasticsearch    ports:      - 24224:24224      - 24224:24224/udp  kibana:    image: kibana    links:      - elasticsearch    ports:      - 5601:5601  nginx:    image: nginx    ports:      - 80:80    links:      - fluentd    logging:      driver: "fluentd"      options:        fluentd-address: localhost:24224        tag: nginx-access

创建目录
fluentd/conf
在目录创建文件

fluent.conf 注意文件名不可更改

    @type forward    port 24224    bind 0.0.0.0    @type copy            @type elasticsearch        host elasticsearch        port 9200        logstash_format true        logstash_prefix fluentd        logstash_dataformat %Y%m%d        include_tag_key true        type_name access_log            type_key @log_name        flush_interval 1s                @type stdout    
0