Turn off forwarding of systemd journal messages to syslog-ng
authorTollef Fog Heen <tfheen@err.no>
Wed, 11 Feb 2015 14:11:24 +0000 (15:11 +0100)
committerTollef Fog Heen <tfheen@err.no>
Wed, 11 Feb 2015 14:13:24 +0000 (15:13 +0100)
Modern syslogs (such as rsyslog and syslog-ng > 3.6) pull from the
systemd journal themselves. Tell systemd to not forward the messages
to syslog.  Also change it so syslog-ng no longer hooks into the
syslog.socket early boot stuff, since that causes headaches when it
tries to connect to loghost and can't resolve names.

modules/debian-org/manifests/init.pp
modules/syslog-ng/files/syslog-ng.service
modules/syslog-ng/manifests/init.pp
modules/systemd/files/journald.conf [new file with mode: 0644]
modules/systemd/manifests/init.pp [new file with mode: 0644]

index a192c7d..db9e9d3 100644 (file)
@@ -15,6 +15,7 @@ class debian-org {
        }
 
        if $systemd {
+               include systemd
                $servicefiles = 'present'
        } else {
                $servicefiles = 'absent'
index 4d8fa2b..1248cf5 100644 (file)
@@ -4,12 +4,11 @@ Documentation=man:syslog-ng(8)
 
 [Service]
 Type=notify
-Sockets=syslog.socket
 ExecStart=/usr/sbin/syslog-ng -F
 ExecReload=/bin/kill -HUP $MAINPID
-StandardOutput=null
+StandardOutput=journal
+StandardError=journal
 Restart=always
 
 [Install]
 WantedBy=multi-user.target
-Alias=syslog.service
index b891092..c55b687 100644 (file)
@@ -37,5 +37,10 @@ class syslog-ng {
                        source => 'puppet:///modules/syslog-ng/syslog-ng.service',
                        notify => Exec['systemctl daemon-reload'],
                }
+
+               file { '/etc/systemd/system/syslog.service':
+                       ensure => absent,
+                       notify => Exec['systemctl daemon-reload'],
+               }
        }
 }
diff --git a/modules/systemd/files/journald.conf b/modules/systemd/files/journald.conf
new file mode 100644 (file)
index 0000000..7e6b609
--- /dev/null
@@ -0,0 +1,7 @@
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+[Journal]
+ForwardToSyslog=no
diff --git a/modules/systemd/manifests/init.pp b/modules/systemd/manifests/init.pp
new file mode 100644 (file)
index 0000000..3caa98b
--- /dev/null
@@ -0,0 +1,5 @@
+class systemd {
+       file { '/etc/systemd/journald.conf':
+               source => 'puppet:///modules/systemd/journald.conf',
+       }
+}