forgejo: usar mejor logger

This commit is contained in:
Cat /dev/Nulo 2023-02-19 12:04:47 -03:00
parent a33377d329
commit 9cb709bdd0
2 changed files with 9 additions and 2 deletions

View file

@ -165,7 +165,6 @@ cd "$HOME"
exec chpst -u $USER:$USER /usr/local/bin/forgejo web --config /etc/forgejo.conf 2>&1
`,
// TODO: usar mejor parser
runitLokiLogger(FluentBitParser.Raw, "forgejo")
runitLokiLogger(FluentBitParser.Forgejo, "forgejo")
);
}

View file

@ -32,17 +32,25 @@ export enum FluentBitParser {
Json = "json",
// Raw toma todo lo que haya en una línea y lo guarda en `message`. No recomendado.
Raw = "raw",
Forgejo = "forgejo",
}
async function saveParsers(alpine: Alpine): Promise<void> {
// https://github.com/fluent/fluent-bit/blob/master/conf/parsers.conf
await alpine.writeFile(
parsersPath,
// https://rubular.com/
`
[PARSER]
name raw
format regex
regex ^(?<message>.*?)$
[PARSER]
name forgejo
format regex
regex ^((?<time>\\d{4}\\/\\d{2}\\/\\d{2} \\d{2}:\\d{2}:\\d{2}?) )?((?<trace>.+:.+:.+\\(\\)?) \\[(?<level>.?)\\] )?(?<message>.*?)$
`
);
}