Fix for duplicate logs on an AIO

This changes the array for `rsyslog_client_log_files` which was 
being set as a host fact and creating an ever increasing list of
logs as services are added to a host.

Change-Id: If00d2a31d681819f0ad31ffff3c4a34b2b62d923
Closes-Bug: 1457224
This commit is contained in:
kevin 2015-05-26 10:13:22 -07:00 committed by Kevin Carter
parent c7951c43e2
commit fb165ca562
4 changed files with 10 additions and 29 deletions

View File

@ -44,6 +44,9 @@ rsyslog_client_udp_port: 514
rsyslog_client_tcp_reception: false rsyslog_client_tcp_reception: false
rsyslog_client_tcp_port: 514 rsyslog_client_tcp_port: 514
# Define the log files list as empty
rsyslog_client_log_files: []
# Set the `rsyslog_client_user_defined_targets` to define specific log targets. # Set the `rsyslog_client_user_defined_targets` to define specific log targets.
# This option will allow you to define multiple log targets with different templates # This option will allow you to define multiple log targets with different templates
# and options. The value of this variable is a list of hashes with the following # and options. The value of this variable is a list of hashes with the following

View File

@ -41,35 +41,6 @@
tags: tags:
- rsyslog-client-config - rsyslog-client-config
- name: Set fact for combined log files list and found logs
set_fact:
rsyslog_client_log_files: "{{ log_files.stdout_lines | union(rsyslog_client_log_files) }}"
when: >
rsyslog_client_log_files is defined and
log_files | success
tags:
- rsyslog-client-config
- name: Set fact for found log files list
set_fact:
rsyslog_client_log_files: "{{ log_files.stdout_lines }}"
when: >
rsyslog_client_log_files is not defined and
log_files | success
tags:
- rsyslog-client-config
- name: Check rsyslog_client_log_files is defined
fail:
msg: >
There were no log files defined in `rsyslog_client_log_files`. Please use that
variable to set the files that you want rsyslog to begin shipping logs for. This
variable is a list that requires the full path to all log files. You can also set
`rsyslog_client_log_dir` which will find all "*.log" files using the path
provided.
when: >
rsyslog_client_log_files is not defined
- name: Write rsyslog config for found log files - name: Write rsyslog config for found log files
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"

View File

@ -1,5 +1,9 @@
# {{ ansible_managed }} # {{ ansible_managed }}
{% if log_files is defined %}
{% set rsyslog_client_log_files = log_files.stdout_lines | union(rsyslog_client_log_files) %}
{% endif %}
$WorkDirectory {{ rsyslog_client_spool_directory }} $WorkDirectory {{ rsyslog_client_spool_directory }}
$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%" $template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"

View File

@ -1,3 +1,6 @@
{% if log_files is defined %}
{% set rsyslog_client_log_files = log_files.stdout_lines | union(rsyslog_client_log_files) %}
{% endif %}
{% for log_file in rsyslog_client_log_files %} {% for log_file in rsyslog_client_log_files %}
{{ log_file }} {{ log_file }}
{% endfor %} {% endfor %}