1
0
mirror of https://github.com/krislamo/graylog_demo synced 2026-01-11 22:03:15 +00:00

Compare commits

7 Commits

4 changed files with 93 additions and 65 deletions

22
Vagrantfile vendored
View File

@@ -56,11 +56,25 @@ Vagrant.configure("2") do |config|
systemctl restart rsyslog systemctl restart rsyslog
fi fi
# Setup TLS
if [ ! -f /vagrant/tmp/ca_key.pem ]; then
echo "Generating TLS certificates..."
cd /vagrant/tmp
openssl req -newkey rsa:4096 \
-x509 \
-sha256 \
-days 3650 \
-nodes \
-out ca_cert.pem \
-keyout ca_key.pem \
-subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \
2> /dev/null
fi
# Install td-agent # Install td-agent
cp /vagrant/td-agent.repo /etc/yum.repos.d/ cp /vagrant/td-agent.repo /etc/yum.repos.d/
yum check-update yum check-update
yum install -y td-agent yum install -y td-agent
td-agent-gem install fluent-plugin-secure-forward
td-agent-gem install fluent-plugin-gelf-hs gelf td-agent-gem install fluent-plugin-gelf-hs gelf
systemctl -q enable td-agent systemctl -q enable td-agent
@@ -74,6 +88,8 @@ Vagrant.configure("2") do |config|
node.vm.provision "shell", inline: <<-SHELL node.vm.provision "shell", inline: <<-SHELL
cp /vagrant/td-agent-server.conf /etc/td-agent/td-agent.conf cp /vagrant/td-agent-server.conf /etc/td-agent/td-agent.conf
mkdir -p /var/log/graylog_buffer
chown -R td-agent:td-agent /var/log/graylog_buffer
systemctl restart td-agent systemctl restart td-agent
# Install jq # Install jq
@@ -145,8 +161,8 @@ Vagrant.configure("2") do |config|
# Configure td-agent # Configure td-agent
cp /vagrant/td-agent.conf /etc/td-agent/td-agent.conf cp /vagrant/td-agent.conf /etc/td-agent/td-agent.conf
mkdir -p /var/log/containers mkdir -p /var/log/containers /var/log/fluentd_buffer
chown -R td-agent:td-agent /var/log/containers chown -R td-agent:td-agent /var/log/containers /var/log/fluentd_buffer
chmod -R 755 /var/log chmod -R 755 /var/log
systemctl restart td-agent systemctl restart td-agent

View File

@@ -3,7 +3,7 @@ version: '3.7'
services: services:
traefik: traefik:
image: traefik:2.1.4 image: traefik:2.2.1
restart: always restart: always
networks: networks:
- traefik-net - traefik-net
@@ -32,7 +32,7 @@ services:
tag: traefik tag: traefik
mongo: mongo:
image: mongo:4.2.2 image: mongo:4.2.8
restart: always restart: always
networks: networks:
- graylog - graylog
@@ -44,7 +44,7 @@ services:
tag: graylog.db tag: graylog.db
elasticsearch: elasticsearch:
image: elasticsearch:6.8.6 image: elasticsearch:6.8.10
restart: always restart: always
environment: environment:
- http:host=0.0.0.0 - http:host=0.0.0.0
@@ -65,7 +65,7 @@ services:
tag: graylog.elasticsearch tag: graylog.elasticsearch
graylog: graylog:
image: graylog/graylog:3.2.2 image: graylog/graylog:3.3.2
restart: always restart: always
environment: environment:
- GRAYLOG_PASSWORD_SECRET=LongerPassword01 - GRAYLOG_PASSWORD_SECRET=LongerPassword01

View File

@@ -1,12 +1,12 @@
<source> <source>
@type secure_forward @type forward
shared_key test
self_hostname 172.28.128.30
port 2514 port 2514
secure true <transport tls>
ca_cert_path /vagrant/tmp/ca_cert.pem version TLSv1_2
ca_private_key_path /vagrant/tmp/ca_key.pem insecure true
ca_private_key_passphrase test cert_path /vagrant/tmp/ca_cert.pem
private_key_path /vagrant/tmp/ca_key.pem
</transport>
</source> </source>
<source> <source>
@@ -34,5 +34,9 @@
protocol tcp protocol tcp
host localhost host localhost
port 12201 port 12201
flush_interval 5s <buffer>
@type file
path /var/log/graylog_buffer
flush_interval 0s
</buffer>
</match> </match>

View File

@@ -26,9 +26,14 @@
path /var/log/containers/${tag} path /var/log/containers/${tag}
append true append true
<buffer tag> <buffer tag>
timekey 5s @type file
flush_mode immediate path /var/log/containers/buffer
flush_interval 0s
</buffer> </buffer>
<format>
@type single_value
message_key log
</format>
</store> </store>
<store> <store>
@type rewrite_tag_filter @type rewrite_tag_filter
@@ -41,14 +46,17 @@
</match> </match>
<match **> <match **>
@type secure_forward @type forward
shared_key test transport tls
self_hostname 172.28.128.31 tls_cert_path /vagrant/tmp/ca_cert.pem
secure true
ca_cert_path /vagrant/tmp/ca_cert.pem
<server> <server>
name example.com
host 172.28.128.30 host 172.28.128.30
port 2514 port 2514
</server> </server>
<buffer>
@type file
path /var/log/fluentd_buffer
flush_interval 0s
</buffer>
</match> </match>