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

Secure forward to td-agent on Graylog server

This commit is contained in:
Kris Lamoureux 2020-03-23 16:14:43 -04:00
parent eac9696e19
commit 9815a86386
Signed by: kris
GPG Key ID: A30022791E1719A4
4 changed files with 49 additions and 20 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.vagrant
tmp

16
Vagrantfile vendored
View File

@ -49,12 +49,8 @@ Vagrant.configure("2") do |config|
cp /vagrant/td-agent.repo /etc/yum.repos.d/
yum check-update
yum install -y td-agent
td-agent-gem install fluent-plugin-secure-forward
td-agent-gem install fluent-plugin-gelf-hs gelf
cp /vagrant/td-agent.conf /etc/td-agent/td-agent.conf
mkdir -p /var/log/containers
chown -R td-agent:td-agent /var/log/containers
chmod -R 755 /var/log
systemctl restart td-agent
systemctl -q enable td-agent
SHELL
@ -66,6 +62,9 @@ Vagrant.configure("2") do |config|
if server == "graylog"
node.vm.provision "shell", inline: <<-SHELL
cp /vagrant/td-agent-server.conf /etc/td-agent/td-agent.conf
systemctl restart td-agent
# Install jq
yum install -y epel-release
yum install -y jq
@ -144,6 +143,13 @@ Vagrant.configure("2") do |config|
systemctl restart rsyslog
fi
# Configure td-agent
cp /vagrant/td-agent.conf /etc/td-agent/td-agent.conf
mkdir -p /var/log/containers
chown -R td-agent:td-agent /var/log/containers
chmod -R 755 /var/log
systemctl restart td-agent
# Bring up WordPress test containers
cd /vagrant/wordpress
/usr/local/bin/docker-compose up -d 2> /dev/null

27
td-agent-server.conf Normal file
View File

@ -0,0 +1,27 @@
<source>
@type secure_forward
shared_key test
self_hostname 172.28.128.30
port 2514
secure true
ca_cert_path /vagrant/tmp/ca_cert.pem
ca_private_key_path /vagrant/tmp/ca_key.pem
ca_private_key_passphrase test
</source>
<filter httpd.access>
@type parser
key_name message
reserve_data true
<parse>
@type apache2
</parse>
</filter>
<match **>
@type gelf
protocol tcp
host localhost
port 12201
flush_interval 5s
</match>

View File

@ -19,16 +19,6 @@
</parse>
</source>
<filter httpd.access>
@type parser
key_name message
reserve_data true
<parse>
@type apache2
</parse>
</filter>
<match devel.*>
@type copy
<store>
@ -51,9 +41,14 @@
</match>
<match **>
@type gelf
protocol tcp
host localhost
port 12201
flush_interval 5s
@type secure_forward
shared_key test
self_hostname 172.28.128.31
secure true
ca_cert_path /vagrant/tmp/ca_cert.pem
<server>
host 172.28.128.30
port 2514
</server>
</match>