From 2a086b79353c6d1a6449b3db106ca17323390ec2 Mon Sep 17 00:00:00 2001 From: pengln Date: Fri, 18 Feb 2022 14:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E8=AE=A2sublog=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E5=AF=BC=E8=87=B4=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=90=AB=E6=9C=89none=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playbooks/roles/filebeat/templates/filebeat.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/filebeat/templates/filebeat.yml b/playbooks/roles/filebeat/templates/filebeat.yml index 8fd928e..076e608 100644 --- a/playbooks/roles/filebeat/templates/filebeat.yml +++ b/playbooks/roles/filebeat/templates/filebeat.yml @@ -62,11 +62,11 @@ setup.kibana: {% if 'output' not in logs[log_type] or logs[log_type]['output'] == 'elastic' %} output.elasticsearch: hosts: {{ logs[log_type]['es_hosts'] }} - {% if 'sublog' in logs[log_type] and logs[log_type]['sublog'] -%} - index: "{{ logs[log_type]['index_prefix'] }}-{{ instance_name }}-{{ logs[log_type]['sublog'] }}-%{+yyyy.MM.dd}" #[#1002040] 如果sublog字段配置为none则忽略索引名称中的sublog字段 - {% elif 'sublog' in logs[log_type] and logs[log_type]['sublog'] == 'none' -%} + {% if 'sublog' in logs[log_type] and logs[log_type]['sublog'] == 'none' -%} index: "{{ logs[log_type]['index_prefix'] }}-{{ instance_name }}-%{+yyyy.MM.dd}" + {% elif 'sublog' in logs[log_type] and logs[log_type]['sublog'] -%} + index: "{{ logs[log_type]['index_prefix'] }}-{{ instance_name }}-{{ logs[log_type]['sublog'] }}-%{+yyyy.MM.dd}" {% else -%} index: "{{ logs[log_type]['index_prefix'] }}-{{ instance_name }}-%{[sublog]}-%{+yyyy.MM.dd}" {% endif -%} -- 2.40.1