source hostname label

This commit is contained in:
Arne Teuke
2025-03-11 13:41:04 +01:00
parent d422a6bd49
commit fc7f606e8a

View File

@@ -12,11 +12,11 @@ local.file_match "system_logs" {
loki.process "syslog" {
stage.regex {
expression = `(?P[A-Z][a-z][a-z]\\s{1,2}\\d{1,2}\\s\\d{2}[:]\\d{2}[:]\\d{2})\\s(?P[\\w][\\w\\d\\.@-]*)\\s(?P.*)$`
expression = `(?P<ts>[A-Z][a-z]{2}\s{1,2}\d{1,2}\s\d{2}:\d{2}:\d{2})\s(?P<host>[\w\.\@-]+)\s(?P<log>.*)$`
}
stage.labels {
values = {
hostname = "host"
hostname = "${host}"
}
}
stage.timestamp {
@@ -29,6 +29,7 @@ loki.process "syslog" {
forward_to = [loki.write.loki.receiver]
}
loki.write "loki" {
endpoint {
url = "<%= @ay_loki_url %>"