75 lines
1.6 KiB
Text
75 lines
1.6 KiB
Text
|
{{ ansible_managed | comment }}
|
||
|
|
||
|
module(load="mmrm1stspace")
|
||
|
|
||
|
{%
|
||
|
set input_modules = {
|
||
|
"relp": "imrelp",
|
||
|
"udp": "imudp",
|
||
|
}
|
||
|
%}
|
||
|
|
||
|
{% if rsyslog_inputs is defined %}
|
||
|
# Chargement des modules de collecte des logs
|
||
|
{%
|
||
|
for module in rsyslog_inputs
|
||
|
| map(attribute="proto")
|
||
|
| map("extract", input_modules)
|
||
|
| list
|
||
|
| unique
|
||
|
%}
|
||
|
module(load="{{ module }}")
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
|
||
|
{% if rsyslog_collector_base_dir is defined %}
|
||
|
# Template pour nommage des logs collectés à distance
|
||
|
template(name="incomingFilename" type="list") {
|
||
|
constant(value="{{ rsyslog_collector_base_dir }}/")
|
||
|
property(name="fromhost-ip")
|
||
|
constant(value="/")
|
||
|
property(name="timegenerated" dateFormat="year")
|
||
|
constant(value="-")
|
||
|
property(name="timegenerated" dateFormat="month")
|
||
|
constant(value="-")
|
||
|
property(name="timegenerated" dateFormat="day")
|
||
|
constant(value=".log")
|
||
|
}
|
||
|
{% endif %}
|
||
|
|
||
|
{% if rsyslog_inputs %}
|
||
|
ruleset(name="handleIncomingLogs") {
|
||
|
action(type="mmrm1stspace")
|
||
|
{% if rsyslog_collector_base_dir is defined %}
|
||
|
action(
|
||
|
type="omfile"
|
||
|
dynaFile="incomingFilename"
|
||
|
template="RSYSLOG_FileFormat"
|
||
|
)
|
||
|
{% endif %}
|
||
|
|
||
|
call sendLogsToRemote
|
||
|
}
|
||
|
{% endif %}
|
||
|
|
||
|
{% for input in rsyslog_inputs %}
|
||
|
# TODO: ajouter les options par protocole (TLS p.ex.) ?
|
||
|
input(
|
||
|
type="{{ input_modules[input.proto] }}"
|
||
|
address="{{ input.address }}"
|
||
|
port="{{ input.port }}"
|
||
|
ruleset="handleIncomingLogs"
|
||
|
)
|
||
|
{% endfor %}
|
||
|
|
||
|
{#
|
||
|
|
||
|
# 4. Traitement des journaux "fichiers" à envoyer au collecteur (30-{{app_name}}.conf)
|
||
|
-> {{app_name}}
|
||
|
|
||
|
input(
|
||
|
type="imfile"
|
||
|
…
|
||
|
ruleset="sendLogsRemote"
|
||
|
)
|
||
|
#}
|