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

Log all containers and syslogs'

This commit is contained in:
Kris Lamoureux 2020-03-24 15:22:39 -04:00
parent 9f78958df4
commit b5ab0d95bc
Signed by: kris
GPG Key ID: A30022791E1719A4
4 changed files with 52 additions and 11 deletions

22
Vagrantfile vendored
View File

@ -45,6 +45,17 @@ Vagrant.configure("2") do |config|
# Convenience
yum install -y vim
# Install rsyslog
yum install -y rsyslog
systemctl start rsyslog
systemctl -q enable rsyslog
# Add rsyslog forwarding option if it does not exist
if ! grep -q "127.0.0.1:5140" /etc/rsyslog.conf; then
echo "*.* @127.0.0.1:5140" >> /etc/rsyslog.conf
systemctl restart rsyslog
fi
# Install td-agent
cp /vagrant/td-agent.repo /etc/yum.repos.d/
yum check-update
@ -132,17 +143,6 @@ Vagrant.configure("2") do |config|
systemctl start httpd
systemctl -q enable httpd
# Install rsyslog
yum install -y rsyslog
systemctl start rsyslog
systemctl -q enable rsyslog
# Add rsyslog forwarding option if it does not exist
if ! grep -q "127.0.0.1:5140" /etc/rsyslog.conf; then
echo "*.* @127.0.0.1:5140" >> /etc/rsyslog.conf
systemctl restart rsyslog
fi
# Configure td-agent
cp /vagrant/td-agent.conf /etc/td-agent/td-agent.conf
mkdir -p /var/log/containers

View File

@ -24,12 +24,24 @@ services:
- "traefik.enable=true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
logging:
driver: "fluentd"
options:
fluentd-address: "tcp://127.0.0.1:24224"
fluentd-async-connect: "true"
tag: traefik
mongo:
image: mongo:4.2.2
restart: always
networks:
- graylog
logging:
driver: "fluentd"
options:
fluentd-address: "tcp://127.0.0.1:24224"
fluentd-async-connect: "true"
tag: graylog.db
elasticsearch:
image: elasticsearch:6.8.6
@ -45,6 +57,12 @@ services:
hard: -1
networks:
- graylog
logging:
driver: "fluentd"
options:
fluentd-address: "tcp://127.0.0.1:24224"
fluentd-async-connect: "true"
tag: graylog.elasticsearch
graylog:
image: graylog/graylog:3.2.2
@ -76,6 +94,12 @@ services:
- 12201:12201
# GELF UDP
- 12201:12201/udp
logging:
driver: "fluentd"
options:
fluentd-address: "tcp://127.0.0.1:24224"
fluentd-async-connect: "true"
tag: graylog
networks:
traefik-net:

View File

@ -9,6 +9,17 @@
ca_private_key_passphrase test
</source>
<source>
@type forward
port 24224
</source>
<source>
@type syslog
port 5140
tag system.local
</source>
<filter httpd.access>
@type parser
key_name message

View File

@ -11,6 +11,12 @@ services:
MYSQL_USER: wordpress
MYSQL_PASSWORD: Password1
MYSQL_RANDOM_ROOT_PASSWORD: '1'
logging:
driver: "fluentd"
options:
fluentd-address: "tcp://127.0.0.1:24224"
fluentd-async-connect: "true"
tag: devel.kris.db
wordpress:
depends_on: