summaryrefslogtreecommitdiff
path: root/nixos/hosts/tente/monitoring.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/hosts/tente/monitoring.nix')
-rw-r--r--nixos/hosts/tente/monitoring.nix21
1 files changed, 20 insertions, 1 deletions
diff --git a/nixos/hosts/tente/monitoring.nix b/nixos/hosts/tente/monitoring.nix
index b9c806e..7e92eed 100644
--- a/nixos/hosts/tente/monitoring.nix
+++ b/nixos/hosts/tente/monitoring.nix
@@ -169,13 +169,32 @@ in
loki.source.journal "journal" {
max_age = "12h0m0s"
relabel_rules = discovery.relabel.journal.rules
- forward_to = [loki.write.default.receiver]
+ forward_to = [loki.process.journal.receiver]
labels = {
host = "tente",
job = "systemd-journal",
}
}
+ loki.process "journal" {
+ forward_to = [loki.write.default.receiver]
+
+ stage.match {
+ // Select messages from systemd services that have LogExtraFields=log_format=logfmt.
+ selector = "{__journal_log_format=\"logfmt\"}"
+ stage.logfmt {
+ mapping = { time = "", level = "" }
+ }
+ stage.timestamp {
+ source = "time"
+ format = "RFC3339"
+ }
+ stage.structured_metadata {
+ values = { level = "" }
+ }
+ }
+ }
+
discovery.relabel "journal" {
targets = []