dnsservice/ansible/files/alloy.river
2025-07-20 18:27:50 -05:00

62 lines
1.2 KiB
Plaintext

logging {
level = "info"
}
loki.write "default" {
endpoint {
url = "https://loki.put.gay/loki/api/v1/push"
basic_auth {
username = "loki"
password = "{{hostvars[inventory_hostname].metrics_password}}"
}
}
}
local.file_match "system_logs" {
path_targets = [
{__path__ = "/var/log/syslog"},
{__path__ = "/var/log/messages"},
{__path__ = "/var/log/*.log"},
]
}
loki.source.file "system_logs" {
targets = local.file_match.system_logs.targets
forward_to = [loki.write.default.receiver]
tail_from_end = true
}
local.file_match "journal_logs" {
path_targets = [
{__path__ = "/var/log/journal/*/*"},
]
}
loki.source.journal "journal" {
forward_to = [loki.write.default.receiver]
relabel_rules = loki.relabel.journal.rules
labels = {
job = "systemd-journal",
}
}
loki.relabel "journal" {
forward_to = [loki.write.default.receiver]
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}
rule {
source_labels = ["__journal__hostname"]
target_label = "hostname"
}
rule {
source_labels = ["__journal_priority_keyword"]
target_label = "level"
}
}