docker efk搭建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 注意文件名不可更改

<source>
    @type forward
    port 24224
    bind 0.0.0.0
</source>

<match *.**>
    @type copy
    <store>
        @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
    </store>
    <store>
        @type stdout
    </store>
</match>

以上是关于docker efk搭建的主要内容,如果未能解决你的问题,请参考以下文章

kubernetes集群搭建efk日志收集平台

十九,基于helm搭建EFK日志收集系统

EFK的安装和收集docker容器日志展示

Centos 7.3 简便搭建EFK日志分析

EFK(Elasticsearch + Fluentd + Kibana)方式进行Docker日志收集检索展示

EFK的搭建(未完成)