Hola
Estoy desplegando un PoC de grafana, Loki y Alloy.
Para realizar la ingesta de log transaccionales de IIS para geenrar Dashboard en Grafana, estoy configurando Alloy. Estoy tratando de generar etiquetas y/o labels para facilitar la consulta y generacion del Dashboar den Grafana. El codigo usado en alloy es el siguiente para leer el log de IIS
/*
logging {
level = "debug"
}
*/
livedebugging {
enabled = true
}
local.file_match "iis_logs" {
path_targets = [
{
"__path__" = "C:/inetpub/logs/LogFiles/W3SVC1/*.log",
"job" = "IIS_Default",
"hostname" = "VMDC",
"site" = "Default Web Site",
},
]
}
loki.source.file "iis_logs" {
targets = local.file_match.iis_logs.targets
tail_from_end = true
encoding = "utf-8"
forward_to = [loki.process.iis_parser.receiver]
}
loki.process "iis_parser" {
stage.regex {
expression = "^(?P<date>\\d{4}-\\d{2}-\\d{2}) (?P<time>\\d{2}:\\d{2}:\\d{2}) (?P<server_ip>(::1)|((([a-fA-F0-9]{1,4}:){1,7}[a-fA-F0-9]{1,4})|(::([a-fA-F0-9]{1,4}:){0,5}[a-fA-F0-9]{1,4})|(([a-fA-F0-9]{1,4}:){1,6}:))) (?P<method>\\w{3,10}) (?P<uri_stem>\\/\\S{0,1000}) (?P<uri_query>-|\\S*) (?P<port>\\d{2,5}) (?P<user>-|\\S*) (?P<client_ip>\\b(::1)|(([0-9]{1,3}\\.){3}[0-9]{1,3})|(([a-fA-F0-9]{0,4}:){2,7}[a-fA-F0-9]{0,4})\\b) (?P<user_agent>\\S{0,1000}) (?P<referer>-|http[s]?:\\/\\/\\S{0,})? (?P<status>\\d{3}) (?P<substatus>\\d{1,5}) (?P<win32_status>\\d{1,5}) (?P<time_taken>\\d{1,100})$"
}
stage.drop {
expression = "^#Software:*"
}
stage.drop {
expression = "^#Version:*"
}
stage.drop {
expression = "^#Date:*"
}
stage.drop {
expression = "^#Fields:*"
}
stage.timestamp {
source = "date"
format = "2006-01-02"
}
stage.timestamp {
source = "time"
format = "15:04:05"
}
stage.labels {
values = {
status = "",
method = "",
uri_stem = "",
client_ip = "",
}
}
forward_to = [loki.write.local.receiver]
}
loki.echo "debug" { }
loki.write "local" {
endpoint {
url = "http://localhost:3100/loki/api/v1/push"
}
}
Uso algo similar para leer el log desde los eventos de Windows, teniendo el mismo resultado.
Tienen alguna sugerencia o documentacion qu me peuda guiar para generar esto
Gracias