diff --git a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml index 040f6818..6844dd5e 100755 --- a/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/tasks/main.yml @@ -63,6 +63,17 @@ notify: restart elasticsearch tags: configure +- name: Configure disabled log4j. + template: + src: "templates/disabledlog4j.options.j2" + dest: /etc/elasticsearch/jvm.options.d/disabledlog4j.options + owner: root + group: elasticsearch + mode: 2750 + force: yes + notify: restart elasticsearch + tags: install + # fix in new PR (ignore_errors) - import_tasks: "RMRedHat.yml" diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/disabledlog4j.options.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/disabledlog4j.options.j2 new file mode 100644 index 00000000..ccfefab1 --- /dev/null +++ b/roles/elastic-stack/ansible-elasticsearch/templates/disabledlog4j.options.j2 @@ -0,0 +1,4 @@ +## JVM configuration + +## Disable log4j +-Dlog4j2.formatMsgNoLookups=true \ No newline at end of file diff --git a/roles/opendistro/opendistro-elasticsearch/tasks/main.yml b/roles/opendistro/opendistro-elasticsearch/tasks/main.yml index c7203088..cc37efad 100644 --- a/roles/opendistro/opendistro-elasticsearch/tasks/main.yml +++ b/roles/opendistro/opendistro-elasticsearch/tasks/main.yml @@ -55,6 +55,17 @@ notify: restart elasticsearch tags: install + - name: Configure disabled log4j. + template: + src: "templates/disabledlog4j.options.j2" + dest: /etc/elasticsearch/jvm.options.d/disabledlog4j.options + owner: root + group: elasticsearch + mode: 2750 + force: yes + notify: restart elasticsearch + tags: install + - name: Ensure extra time for Elasticsearch to start on reboots lineinfile: path: /usr/lib/systemd/system/elasticsearch.service diff --git a/roles/opendistro/opendistro-elasticsearch/templates/disabledlog4j.options.j2 b/roles/opendistro/opendistro-elasticsearch/templates/disabledlog4j.options.j2 new file mode 100644 index 00000000..ccfefab1 --- /dev/null +++ b/roles/opendistro/opendistro-elasticsearch/templates/disabledlog4j.options.j2 @@ -0,0 +1,4 @@ +## JVM configuration + +## Disable log4j +-Dlog4j2.formatMsgNoLookups=true \ No newline at end of file