|
|
69e14a |
From 3967a2b0e7e61dfb6317296a4cf15d0fe91a1638 Mon Sep 17 00:00:00 2001
|
|
|
69e14a |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
69e14a |
Date: Thu, 15 Oct 2020 10:52:29 -0700
|
|
|
69e14a |
Subject: [PATCH 7/7] RHELPLAN-56807 - Logging - elasticsearch - need to adjust
|
|
|
69e14a |
jinja2 boolean values to the rsyslog config values
|
|
|
69e14a |
|
|
|
69e14a |
Resetting the values of the following params as rsyslog expects.
|
|
|
69e14a |
dynSearchIndex, bulkmode, dynbulkid, allowUnsignedCerts, usehttps
|
|
|
69e14a |
|
|
|
69e14a |
Adding test cases to tests_ovirt_elasticsearch_params.yml
|
|
|
69e14a |
|
|
|
69e14a |
(cherry picked from commit c98aabd864f6d07c11d6db991bf0af0aaee7f123)
|
|
|
69e14a |
---
|
|
|
69e14a |
.../rsyslog/templates/output_elasticsearch.j2 | 13 ++++-----
|
|
|
69e14a |
tests/tests_ovirt_elasticsearch_params.yml | 29 +++++++++++++++++--
|
|
|
69e14a |
2 files changed, 33 insertions(+), 9 deletions(-)
|
|
|
69e14a |
|
|
|
69e14a |
diff --git a/roles/rsyslog/templates/output_elasticsearch.j2 b/roles/rsyslog/templates/output_elasticsearch.j2
|
|
|
69e14a |
index c4db10f..6c6255b 100644
|
|
|
69e14a |
--- a/roles/rsyslog/templates/output_elasticsearch.j2
|
|
|
69e14a |
+++ b/roles/rsyslog/templates/output_elasticsearch.j2
|
|
|
69e14a |
@@ -37,25 +37,24 @@ ruleset(name="{{ item.name }}") {
|
|
|
69e14a |
serverport="{{ item.server_port | d(9200) | int }}"
|
|
|
69e14a |
template="{{ item.template | d("es_template") }}"
|
|
|
69e14a |
searchIndex="{{ item.searchIndex | d("index_template") }}"
|
|
|
69e14a |
- dynSearchIndex="{{ item.dynSearchIndex | d("on") }}"
|
|
|
69e14a |
+ dynSearchIndex="{{ item.dynSearchIndex | d(true) | ternary('on', 'off') }}"
|
|
|
69e14a |
searchType="{{ item.searchType | d("com.redhat.viaq.common") }}"
|
|
|
69e14a |
- bulkmode="{{ item.bulkmode | d("on") }}"
|
|
|
69e14a |
+ bulkmode="{{ item.bulkmode | d(true) | ternary('on', 'off') }}"
|
|
|
69e14a |
writeoperation="{{ item.writeoperation | d("create") }}"
|
|
|
69e14a |
bulkid="{{ item.bulkid | d("id_template") }}"
|
|
|
69e14a |
- dynbulkid="{{ item.dynbulkid | d('on') }}"
|
|
|
69e14a |
- allowUnsignedCerts="{{ item.allowUnsignedCerts | d("off") }}"
|
|
|
69e14a |
+ dynbulkid="{{ item.dynbulkid | d(true) | ternary('on', 'off') }}"
|
|
|
69e14a |
+ allowUnsignedCerts="{{ item.allowUnsignedCerts | d(false) | ternary('on', 'off') }}"
|
|
|
69e14a |
{% if item.retryfailures | d(true) %}
|
|
|
69e14a |
-{% if item.retryruleset | d() | length > 0 %}
|
|
|
69e14a |
retryfailures="on"
|
|
|
69e14a |
+{% if item.retryruleset | d() | length > 0 %}
|
|
|
69e14a |
retryruleset="{{ item.retryruleset }}"
|
|
|
69e14a |
{% else %}
|
|
|
69e14a |
- retryfailures="on"
|
|
|
69e14a |
retryruleset="{{ item.name }}"
|
|
|
69e14a |
{% endif %}
|
|
|
69e14a |
{% else %}
|
|
|
69e14a |
retryfailures="off"
|
|
|
69e14a |
{% endif %}
|
|
|
69e14a |
- usehttps="{{ item.usehttps | default("on") }}"
|
|
|
69e14a |
+ usehttps="{{ item.usehttps | d(true) | ternary('on', 'off') }}"
|
|
|
69e14a |
{% if item.use_cert | default(true) %}
|
|
|
69e14a |
tls.cacert="{{ item.ca_cert | default('/etc/rsyslog.d/es-ca.crt') }}"
|
|
|
69e14a |
tls.mycert="{{ item.cert | default('/etc/rsyslog.d/es-cert.pem') }}"
|
|
|
69e14a |
diff --git a/tests/tests_ovirt_elasticsearch_params.yml b/tests/tests_ovirt_elasticsearch_params.yml
|
|
|
69e14a |
index 34d9e1d..4fefe59 100644
|
|
|
69e14a |
--- a/tests/tests_ovirt_elasticsearch_params.yml
|
|
|
69e14a |
+++ b/tests/tests_ovirt_elasticsearch_params.yml
|
|
|
69e14a |
@@ -34,6 +34,8 @@
|
|
|
69e14a |
__test_ovirt_engine_conf: /etc/rsyslog.d/90-input-ovirt-ovirt_engine_input.conf
|
|
|
69e14a |
__test_ovirt_vdsm_conf: /etc/rsyslog.d/90-input-ovirt-ovirt_vdsm_input.conf
|
|
|
69e14a |
__test_ovirt_bogus_conf: /etc/rsyslog.d/90-input-ovirt-ovirt_bogus_input.conf
|
|
|
69e14a |
+ __test_es_conf: /etc/rsyslog.d/31-output-elasticsearch-elasticsearch_output.conf
|
|
|
69e14a |
+ __test_es_ops_conf: /etc/rsyslog.d/31-output-elasticsearch-elasticsearch_output_ops.conf
|
|
|
69e14a |
__test_collectd_name: ovirt_collectd_input
|
|
|
69e14a |
__test_engine_name: ovirt_engine_input
|
|
|
69e14a |
__test_vdsm_name: ovirt_vdsm_input
|
|
|
69e14a |
@@ -56,7 +58,6 @@
|
|
|
69e14a |
server_port: 9200
|
|
|
69e14a |
index_prefix: project.
|
|
|
69e14a |
input_type: ovirt
|
|
|
69e14a |
- retryfailures: false
|
|
|
69e14a |
ca_cert: "/etc/rsyslog.d/es-ca.crt"
|
|
|
69e14a |
cert: "/etc/rsyslog.d/es-cert.pem"
|
|
|
69e14a |
private_key: "/etc/rsyslog.d/es-key.pem"
|
|
|
69e14a |
@@ -70,6 +71,11 @@
|
|
|
69e14a |
ca_cert: "/etc/rsyslog.d/es-ca.crt"
|
|
|
69e14a |
cert: "/etc/rsyslog.d/es-cert.pem"
|
|
|
69e14a |
private_key: "/etc/rsyslog.d/es-key.pem"
|
|
|
69e14a |
+ dynSearchIndex: false
|
|
|
69e14a |
+ bulkmode: false
|
|
|
69e14a |
+ dynbulkid: false
|
|
|
69e14a |
+ allowUnsignedCerts: true
|
|
|
69e14a |
+ usehttps: false
|
|
|
69e14a |
logging_inputs:
|
|
|
69e14a |
- name: basic_input
|
|
|
69e14a |
type: basics
|
|
|
69e14a |
@@ -164,4 +170,23 @@
|
|
|
69e14a |
|
|
|
69e14a |
- name: Check index_prefix is "{{ __test_logs_index }}" in "{{ __test_ovirt_vdsm_conf }}"
|
|
|
69e14a |
command: /bin/grep 'set $.index_prefix = "{{ __test_logs_index }}"' {{ __test_ovirt_vdsm_conf }}
|
|
|
69e14a |
- changed_when: false
|
|
|
69e14a |
+
|
|
|
69e14a |
+ - name: Check default config params in "{{ __test_es_conf }}"
|
|
|
69e14a |
+ command: /bin/grep {{ item }} {{ __test_es_conf }}
|
|
|
69e14a |
+ loop:
|
|
|
69e14a |
+ - "dynSearchIndex=.on."
|
|
|
69e14a |
+ - "bulkmode=.on."
|
|
|
69e14a |
+ - "dynbulkid=.on."
|
|
|
69e14a |
+ - "allowUnsignedCerts=.off."
|
|
|
69e14a |
+ - "usehttps=.on."
|
|
|
69e14a |
+ - "retryfailures=.on."
|
|
|
69e14a |
+
|
|
|
69e14a |
+ - name: Check modified config params in "{{ __test_es_ops_conf }}"
|
|
|
69e14a |
+ command: /bin/grep {{ item }} {{ __test_es_ops_conf }}
|
|
|
69e14a |
+ loop:
|
|
|
69e14a |
+ - "dynSearchIndex=.off."
|
|
|
69e14a |
+ - "bulkmode=.off."
|
|
|
69e14a |
+ - "dynbulkid=.off."
|
|
|
69e14a |
+ - "allowUnsignedCerts=.on."
|
|
|
69e14a |
+ - "usehttps=.off."
|
|
|
69e14a |
+ - "retryfailures=.off."
|
|
|
69e14a |
--
|
|
|
69e14a |
2.26.2
|
|
|
69e14a |
|