From 79c9a18947908c96d01e23a44a17c516ef9fd0bd Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Wed, 29 Jan 2020 16:28:17 -0500 Subject: [PATCH] Export Docker logs to rsyslog Set Docker log driver to syslog and enabled TCP rsyslog reception --- Vagrantfile | 4 ++++ docker-daemon.json | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index e5bbdbe..a409ef1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -40,6 +40,10 @@ Vagrant.configure("2") do |config| systemctl start rsyslog systemctl -q enable rsyslog + # Enable TCP syslog reception + sed -i 's/#\$ModLoad imtcp/\$ModLoad imtcp/g' /etc/rsyslog.conf + sed -i 's/#\$InputTCPServerRun 514/\$InputTCPServerRun 514/g' /etc/rsyslog.conf + # Add rsyslog forwarding option if it does not exist if ! grep -q "#{PRIVATE_NET_IP}:1514" /etc/rsyslog.conf; then echo "*.* @@#{PRIVATE_NET_IP}:1514;RSYSLOG_SyslogProtocol23Format" >> /etc/rsyslog.conf diff --git a/docker-daemon.json b/docker-daemon.json index 3536413..88bd02f 100644 --- a/docker-daemon.json +++ b/docker-daemon.json @@ -1,6 +1,6 @@ { - "log-driver": "gelf", - "log-opts": { - "gelf-address": "tcp://172.28.128.30:12201" + "log-driver": "syslog", + "log-opts": { + "syslog-address": "tcp://127.0.0.1:514" } }