Feature: Add Vector Log Shipping to Loki for Keycloak #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/add-vector-log-shipper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR introduces a new, reusable NixOS module for shipping
systemdjournal logs to a remote sink using Vector. It immediately implements this module on thekeycloak-devhost to parse and forward Keycloak logs to Grafana Loki.Key Changes
modules/vector/default.nix)services.vectorJournaldToSinkabstraction.journaldsource and alokisink using Snappy compression and JSON encoding..serviceand.hostfields) and exposes anextraTransformSourceoption for custom Vector Remap Language (VRL) transformations.execsecret backend to ensure the token never enters the Nix store.vectoruser, granting itsystemd-journalaccess.hosts/keycloak-dev/configuration.nix)keycloakDomainvariable.keycloak.serviceand ship to thelogs-prod-012Grafana Loki instance..leveland.loggerName, and mapping the message to.keycloak_msg.service_name,deployment_environment,domain,url) to the log streams.vector/loki_api_tokenvia SOPS with proper ownership assigned to thevectoruser.flake.nix,secrets.enc.yaml)vectorJournaldToSinkinnixosModulesand wires it into thekeycloak-devhost.@ -0,0 +34,4 @@type = lib.types.path;description = ''Path to a file containing only the loki API token.Loaded via systemd EnvironmentFile, never ends up in the Nix store.Einfach gelogen 😄
Hab ich gelöscht.
@ -0,0 +86,4 @@};users.groups.vector = { };environment.etc."vector/get-secrets.sh" = lib.mkIf (cfg.sinkType == "loki") {Lass mal keine komischen scripte unter /etc abglegen.
SystemD kann das alles schon.
Ist jetzt umgebaut auf systemd-LoadCredential.
@ -0,0 +114,4 @@'';};secret.loki_token = lib.mkIf (cfg.sinkType == "loki") {