From e3ed01d7e18fab524fb285543d3330f60b1954f8 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Fri, 7 Jun 2024 14:14:16 +0100 Subject: Extend Alloy configuration to include some default files + extra files --- ansible/roles/alloy/templates/config.alloy.j2 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'ansible') diff --git a/ansible/roles/alloy/templates/config.alloy.j2 b/ansible/roles/alloy/templates/config.alloy.j2 index ac27875..d0cfea1 100644 --- a/ansible/roles/alloy/templates/config.alloy.j2 +++ b/ansible/roles/alloy/templates/config.alloy.j2 @@ -1,3 +1,30 @@ +// Managed by Ansible + logging { level = "info" } + +loki.source.journal "system_journal" { + format_as_json = true + forward_to = [] +} + +loki.source.file "auth_log" { + targets = [ + {__path__ = "/var/log/auth.log"}, + ] + forward_to = [] +} + +{% for extra in alloy_extra_files %} + +local.file_match "match_{{ extra.name }}" { + path_targets = [{"__path__" = "{{ extra.path }}"}] +} + +loki.source.file "log_{{ extra.name }}" { + targets = local.file_match.match_{{ extra.name }}.targets + forward_to = [] +} + +{% endfor %} -- cgit v1.2.3