diff options
| author | 2024-06-07 14:14:16 +0100 | |
|---|---|---|
| committer | 2024-06-07 16:48:18 +0100 | |
| commit | e3ed01d7e18fab524fb285543d3330f60b1954f8 (patch) | |
| tree | 6a23ffb7d32309c44b70059b93b3780ac39bccc0 | |
| parent | Update default variables for Alloy with empty extra files list (diff) | |
Extend Alloy configuration to include some default files + extra files
| -rw-r--r-- | ansible/roles/alloy/templates/config.alloy.j2 | 27 |
1 files changed, 27 insertions, 0 deletions
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 %} |