1
0
mirror of https://github.com/krislamo/graylog_demo synced 2024-09-19 21:50:36 +00:00

Added fluentd

Reordered compose commands to bring up graylog first and
added fluentd.
This commit is contained in:
Kris Lamoureux 2020-02-07 16:14:50 -05:00
parent 689065b082
commit 8e0c666948
Signed by: kris
GPG Key ID: A30022791E1719A4
6 changed files with 36 additions and 9 deletions

4
Vagrantfile vendored
View File

@ -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

View File

@ -1,6 +0,0 @@
{
"log-driver": "syslog",
"log-opts": {
"syslog-address": "tcp://127.0.0.1:514"
}
}

9
fluentd/Dockerfile Normal file
View File

@ -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/

11
fluentd/fluent.conf Normal file
View File

@ -0,0 +1,11 @@
<source>
@type forward
port 24224
</source>
<match **>
@type gelf
host vagrant_graylog_1
port 12201
flush_interval 5s
</match>

View File

@ -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

View File

@ -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: {}