X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=roles%2Flogging%2Ftemplates%2Flogforwarding.j2;fp=roles%2Flogging%2Ftemplates%2Flogforwarding.j2;h=857592cf0b2f389ba59b70f4fee087e080bd6130;hb=74a49ba6ef2ea715fa492db0bcd85c30398688e8;hp=0000000000000000000000000000000000000000;hpb=a936af362724cca0c5dc2c424902d398f9833410;p=ta%2Finfra-ansible.git diff --git a/roles/logging/templates/logforwarding.j2 b/roles/logging/templates/logforwarding.j2 new file mode 100644 index 0000000..857592c --- /dev/null +++ b/roles/logging/templates/logforwarding.j2 @@ -0,0 +1,27 @@ +# +# Ansible managed +# +# This is the runtime configuration for log forwarding to external server. +# If a configuration is active, the rsyslog-master instance will forward +# logs to the configured external server. +# +# Last written: {{ lookup('pipe','date --rfc-3339=seconds') }} +# +{% if log_forwarding is defined %} +template(name="RSYSLOG_SyslogProtocol23Format_with_cloudname" type="string" + string="<%PRI%>1 %TIMESTAMP:::date-rfc3339% %HOSTNAME%.{{ name }} %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% %msg%\n") + +{% if log_forwarding['tls'] == "on" %} +$DefaultNetstreamDriver gtls +$ActionSendStreamDriverMode 1 +$ActionSendStreamDriverAuthMode anon +$DefaultNetstreamDriverCAFile /dev/null + +*.* @@(o)[{{ log_forwarding['ip_address'] }}]:{{ log_forwarding['port'] }}; RSYSLOG_SyslogProtocol23Format_with_cloudname +{% else %} +*.* action(type="omfwd" target="{{ log_forwarding['ip_address'] }}" port="{{ log_forwarding['port'] }}" protocol="{{ log_forwarding['protocol'] }}" template="RSYSLOG_SyslogProtocol23Format_with_cloudname") +{% endif %} +{% else %} +# No active configuration +# +{% endif %}