2020年9月10日木曜日

EFK ログ収集(お試し:wordpress編)

1)wordpress用のdocker-composeにfluentdの設定を記載する

=============================-

version: '3.7'

services:

  db:

    image: mysql:5.7

    volumes:

      - "./.data/db:/var/lib/mysql"

    restart: always

    environment:

      MYSQL_ROOT_PASSWORD: wordpress

      MYSQL_DATABASE: wordpress

      MYSQL_USER: wordpress

      MYSQL_PASSWORD: wordpress

    ports:

      - "4306:3306"

    logging:

      driver: "fluentd"

      options:

        fluentd-address: 192.168.0.102:24224

        tag: fluent


  wordpress:

    image: wordpress:php7.3-fpm

    restart: always

    environment:

      WORDPRESS_DB_HOST: db:3306

      WORDPRESS_DB_PASSWORD: wordpress

    volumes:

      - ./conf.d/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini

      - ./wordpress:/var/www/html

    logging:

      driver: "fluentd"

      options:

        fluentd-address: 192.168.0.102:24224

        tag: fluent


  nginx:

    image: nginx:stable

    ports:

      - "8000:80"

    volumes:

      - ./nginx/nginx.conf:/etc/nginx/nginx.conf

      - ./nginx/conf.d:/etc/nginx/conf.d

      - ./nginx/log:/var/log/nginx

      - ./wordpress:/var/www/html

    restart: always

    environment:

      CLIENT_MAX_BODY_SIZE: 300M

    logging:

      driver: "fluentd"

      options:

        fluentd-address: 192.168.0.102:24224

        tag: fluent

======================================



2)実施にwordpressにて、書き込みを行って後に

Kibanaのログ画面を確認してみる




0 件のコメント:

コメントを投稿

php log(ECS ログ出力)

# PHPエラーログの設定 ENV PHP_INI_DIR /usr/local/etc/php RUN { \ echo 'log_errors = On' ; \ echo 'error_log = /proc/self/...