1
0
mirror of https://github.com/krislamo/graylog_demo synced 2024-11-09 21:50:35 +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 # Convenience
yum install -y vim 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 # 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
@ -132,17 +143,6 @@ Vagrant.configure("2") do |config|
systemctl start httpd systemctl start httpd
systemctl -q enable 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 # 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

View File

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

View File

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

View File

@ -11,6 +11,12 @@ services:
MYSQL_USER: wordpress MYSQL_USER: wordpress
MYSQL_PASSWORD: Password1 MYSQL_PASSWORD: Password1
MYSQL_RANDOM_ROOT_PASSWORD: '1' 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: wordpress:
depends_on: depends_on: