logstash: logging to syslog is configurable (default: True)

This commit is contained in:
Jérémy Lecour 2021-09-21 14:41:07 +02:00 committed by Jérémy Lecour
parent ef1472cbba
commit 8233264d2a
5 changed files with 37 additions and 1 deletions

View File

@ -19,6 +19,7 @@ The **patch** part changes incrementally at each release.
* generate-ldif: detect hardware raid card * generate-ldif: detect hardware raid card
* generate-ldif: detect mdadm * generate-ldif: detect mdadm
* listupgrade: crontab is configurable * listupgrade: crontab is configurable
* logstash: logging to syslog is configurable (default: True)
* mongodb: create munin plugins directory if missing * mongodb: create munin plugins directory if missing
* mysql: script "mysql_connections" to display a compact list of connections * mysql: script "mysql_connections" to display a compact list of connections
* mysql: script "mysql-queries-killer.sh" to kill MySQL queries * mysql: script "mysql-queries-killer.sh" to kill MySQL queries

View File

@ -6,3 +6,5 @@ logstash_jvm_xmx: 512g
logstash_log_rotate_days: 365 logstash_log_rotate_days: 365
logstash_custom_tmpdir: Null logstash_custom_tmpdir: Null
logstash_default_tmpdir: /var/lib/logstash/tmp logstash_default_tmpdir: /var/lib/logstash/tmp
logstash_log_syslog_enabled: True
logstash_config_force: True

View File

@ -0,0 +1,10 @@
---
- name: restart logstash
systemd:
name: logstash
state: restarted
daemon_reload: yes
- name: reload systemd
command: systemctl daemon-reload

View File

@ -16,3 +16,26 @@
group: root group: root
mode: "0750" mode: "0750"
when: is_cron_installed.rc == 0 when: is_cron_installed.rc == 0
- name: "Create a system config directory for systemd overrides"
file:
path: /etc/systemd/system/logstash.service.d
state: directory
- name: "disable syslog"
ini_file:
path: /etc/systemd/system/logstash.service.d/override.conf
section: Service
option: "{{ item.option }}"
value: "{{ item.value }}"
owner: root
group: root
mode: "0644"
create: yes
no_extra_spaces: yes
state: "{{ logstash_log_syslog_enabled | bool | ternary('absent','present') }}"
loop:
- { option: "StandardOutput", value: "null" }
- { option: "StandardError", value: "null" }
notify:
- restart logstash

View File

@ -88,7 +88,7 @@
owner: logstash owner: logstash
group: logstash group: logstash
mode: "0640" mode: "0640"
force: yes force: "{{ logstash_config_force | bool }}"
loop: "{{ query('first_found', templates) }}" loop: "{{ query('first_found', templates) }}"
vars: vars:
templates: templates: