openstack-ansible-rsyslog_c.../templates/remote-logging.j2
Ravi Kumar Boyapati 3edc8e144f Fix remote logging template
Since the intent of the role is to stream only specified logs
updated the filter to match local7 facility which the role is setting
for the application logs with "$InputFileFacility local7" in
99-rsyslog.conf.j2 template.

Change-Id: I531652300440d12cb98ada9c6eac44e9d4ab731f
2017-03-17 00:02:22 -04:00

46 lines
1.4 KiB
Django/Jinja

# {{ ansible_managed }}
$WorkDirectory {{ rsyslog_client_spool_directory }}
$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"
{% if groups['rsyslog_all'] is defined and groups['rsyslog_all'] %}
# Log shipment rsyslog target servers
{% for server in groups['rsyslog_all'] %}
$ActionQueueFileName {{ server }}
$ActionQueueSaveOnShutdown on
$ActionQueueType LinkedList
$ActionResumeRetryCount 250
{% if rsyslog_client_tcp_reception == true %}
local7.* @@{{ hostvars[server]['ansible_host'] }}:{{ rsyslog_client_tcp_port }};RFC3164fmt
{% endif %}
{% if rsyslog_client_udp_reception == true %}
local7.* @{{ hostvars[server]['ansible_host'] }}:{{ rsyslog_client_udp_port }};RFC3164fmt
{% endif %}
{% endfor %}
{% endif %}
{% if rsyslog_client_user_defined_targets is defined %}
# Log shipment user defined target servers
{% for target in rsyslog_client_user_defined_targets %}
$ActionQueueFileName {{ target.name }}
$ActionQueueSaveOnShutdown on
$ActionQueueType LinkedList
$ActionResumeRetryCount 250
{% if target.template is defined %}
{{ target.template }}
{% endif %}
{% if target.proto == "udp" %}
{% set action_sting = 'local7.* @' %}
{% elif target.proto == "tcp" %}
{% set action_sting = 'local7.* @@' %}
{% endif %}
{% if target.action_options is defined %}
{{ action_sting }}{{ target.hostname }}:{{ target.port }};{{ target.action_options }}
{% else %}
{{ action_sting }}{{ target.hostname }}:{{ target.port }}
{% endif %}
{% endfor %}
{% endif %}