diff --git a/Vagrantfile b/Vagrantfile index a409ef1..e6cecf2 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -26,8 +26,6 @@ Vagrant.configure("2") do |config| yum-config-manager --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo yum install -y docker-ce docker-ce-cli containerd.io - mkdir -p /etc/docker/ - cp --update /vagrant/docker-daemon.json /etc/docker/daemon.json systemctl start docker systemctl -q enable docker usermod -aG docker vagrant @@ -58,8 +56,8 @@ Vagrant.configure("2") do |config| # Start compose services config.vm.provision "shell", inline: <<-SHELL cd /vagrant - /usr/local/bin/docker-compose -f wordpress.yml up -d 2> /dev/null /usr/local/bin/docker-compose -f graylog.yml up -d 2> /dev/null + /usr/local/bin/docker-compose -f wordpress.yml up -d 2> /dev/null SHELL end diff --git a/docker-daemon.json b/docker-daemon.json deleted file mode 100644 index 88bd02f..0000000 --- a/docker-daemon.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "log-driver": "syslog", - "log-opts": { - "syslog-address": "tcp://127.0.0.1:514" - } -} diff --git a/fluentd/Dockerfile b/fluentd/Dockerfile new file mode 100644 index 0000000..545af56 --- /dev/null +++ b/fluentd/Dockerfile @@ -0,0 +1,9 @@ +FROM fluent/fluentd:v1.9.0-debian-1.0 +USER root +RUN apt-get update \ + && apt-get -y install --no-install-recommends wget \ + && rm -rf /var/lib/apt/lists/* +RUN gem install gelf +RUN cd /fluentd/plugins \ + && wget -q https://raw.githubusercontent.com/emsearcy/fluent-plugin-gelf/master/lib/fluent/plugin/out_gelf.rb +COPY fluent.conf /fluentd/etc/ diff --git a/fluentd/fluent.conf b/fluentd/fluent.conf new file mode 100644 index 0000000..d889e71 --- /dev/null +++ b/fluentd/fluent.conf @@ -0,0 +1,11 @@ + + @type forward + port 24224 + + + + @type gelf + host vagrant_graylog_1 + port 12201 + flush_interval 5s + diff --git a/graylog.yml b/graylog.yml index 7c3611d..ae6ce70 100644 --- a/graylog.yml +++ b/graylog.yml @@ -1,6 +1,16 @@ version: '3.7' services: + + fluentd: + build: ./fluentd + restart: always + networks: + - graylog + ports: + - 24224:24224 + - 24224:24224/udp + mongo: image: mongo:4.2.2 restart: always diff --git a/wordpress.yml b/wordpress.yml index 062cda7..6f69840 100644 --- a/wordpress.yml +++ b/wordpress.yml @@ -24,5 +24,10 @@ services: WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: Password1 WORDPRESS_DB_NAME: wordpress + logging: + driver: "fluentd" + options: + fluentd-address: "tcp://127.0.0.1:24224" + volumes: db_data: {}