From cc3b036b88726ede02e478bf8287e7c9b24b7b98 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Fri, 7 Jun 2024 15:18:18 +0100 Subject: Update configuration template with authentication --- ansible/roles/alloy/templates/config.alloy.j2 | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'ansible') diff --git a/ansible/roles/alloy/templates/config.alloy.j2 b/ansible/roles/alloy/templates/config.alloy.j2 index d0cfea1..23b2ec0 100644 --- a/ansible/roles/alloy/templates/config.alloy.j2 +++ b/ansible/roles/alloy/templates/config.alloy.j2 @@ -6,14 +6,7 @@ logging { loki.source.journal "system_journal" { format_as_json = true - forward_to = [] -} - -loki.source.file "auth_log" { - targets = [ - {__path__ = "/var/log/auth.log"}, - ] - forward_to = [] + forward_to = [loki.write.pydis_gateway.receiver] } {% for extra in alloy_extra_files %} @@ -24,7 +17,23 @@ local.file_match "match_{{ extra.name }}" { loki.source.file "log_{{ extra.name }}" { targets = local.file_match.match_{{ extra.name }}.targets - forward_to = [] + forward_to = [loki.write.pydis_gateway.receiver] } {% endfor %} + +loki.write "pydis_gateway" { + external_labels = { + hostname = env("HOSTNAME"), + } + endpoint { + url = "{{ alloy_loki_endpoint }}/loki/api/v1/push" + basic_auth { + username = "{{ alloy_loki_user }}" + password = "{{ alloy_loki_password }}" + } + headers = { + "X-Scope-OrgID" = "1", + } + } +} -- cgit v1.2.3