Browse Source

icinga2: fix log flooding by closing stdio

Philipp Fromme 3 years ago
parent
commit
c3cac6084c
2 changed files with 19 additions and 0 deletions
  1. 15 0
      icinga2/init.sls
  2. 4 0
      icinga2/systemd.override.conf

+ 15 - 0
icinga2/init.sls

@@ -17,6 +17,21 @@ icinga2:
     - enable: True
     - reload: True
 
+# Create directory for systemd overrides
+/etc/systemd/system/icinga2.service.d:
+  file.directory:
+    - require:
+      - pkg: icinga2
+
+# Add override for ExecStart to close stdio
+/etc/systemd/system/icinga2.service.d/override.conf:
+  file.managed:
+    - source: salt://icinga2/systemd.override.conf
+    - require:
+      - file: /etc/systemd/system/icinga2.service.d
+    - watch_in:
+      - service: icinga2
+
 # Install plugins (official + our own)
 monitoring-plugin-pkgs:
   pkg.installed:

+ 4 - 0
icinga2/systemd.override.conf

@@ -0,0 +1,4 @@
+[Service]
+Environment="ICINGA2_ERROR_LOG=/var/log/icinga2/error.log"
+ExecStart=
+ExecStart=/usr/sbin/icinga2 daemon --close-stdio -e ${ICINGA2_ERROR_LOG}