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 exec chpst -u $USER:$USER /usr/local/bin/forgejo web --config /etc/forgejo.conf 2>&1
`, `,
// TODO: usar mejor parser runitLokiLogger(FluentBitParser.Forgejo, "forgejo")
runitLokiLogger(FluentBitParser.Raw, "forgejo")
); );
} }

View file

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