Files
datasaker-agent-ansible/templates/log-agent-config.yml.j2
havelight-ee b9fefae7ff update
2023-06-22 13:53:23 +09:00

32 lines
1.1 KiB
Django/Jinja

agent:
metadata:
agent_name: "{{ log_agent_name | default('dsk-log-agent') }}"
collect:
{% for collect_item in log_collects | default([{'paths': ['/var/log/*.log'], 'exclude_paths': [], 'keywords': [], 'tag': 'Default', 'service': {'name': 'default', 'category': 'etc', 'type': 'etc'}}]) %}
- paths:
{% for path in collect_item.paths %}
- "{{ path }}"
{% endfor %}
exclude_paths:
{% if collect_item.exclude_paths | default([]) %}
{% for exclude_path in collect_item.exclude_paths %}
- "{{ exclude_path }}"
{% endfor %}
{% endif %}
keywords:
{% if collect_item.keywords | default([]) %}
{% for keyword in collect_item.keywords %}
- "{{- keyword -}}"
{% endfor %}
{% endif %}
{% if collect_item.tag is defined %}
tag: "{{ collect_item.tag }}"
{% endif %}
service:
name: "{{ collect_item.service.name }}"
category: "{{ collect_item.service.category }}"
type: "{{ collect_item.service.type }}"
{% if collect_item.service.address is defined %}
address: "{{ collect_item.service.address }}"
{% endif %}
{% endfor %}