Initial commit
[ta/infra-ansible.git] / roles / logging / templates / logforwarding.j2
1 #
2 # Ansible managed
3 #
4 # This is the runtime configuration for log forwarding to external server.
5 # If a configuration is active, the rsyslog-master instance will forward
6 # logs to the configured external server.
7 #
8 # Last written: {{ lookup('pipe','date --rfc-3339=seconds') }}
9 #
10 {% if log_forwarding is defined %}
11 template(name="RSYSLOG_SyslogProtocol23Format_with_cloudname" type="string"
12      string="<%PRI%>1 %TIMESTAMP:::date-rfc3339% %HOSTNAME%.{{ name }} %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% %msg%\n")
13
14 {% if log_forwarding['tls'] == "on" %}
15 $DefaultNetstreamDriver gtls
16 $ActionSendStreamDriverMode 1
17 $ActionSendStreamDriverAuthMode anon
18 $DefaultNetstreamDriverCAFile /dev/null
19
20 *.* @@(o)[{{ log_forwarding['ip_address'] }}]:{{ log_forwarding['port'] }}; RSYSLOG_SyslogProtocol23Format_with_cloudname
21 {% else %}
22 *.* action(type="omfwd" target="{{ log_forwarding['ip_address'] }}" port="{{ log_forwarding['port'] }}" protocol="{{ log_forwarding['protocol'] }}" template="RSYSLOG_SyslogProtocol23Format_with_cloudname")
23 {% endif %}
24 {% else %}
25 # No active configuration
26 #
27 {% endif %}