grafana: loggear a loki

This commit is contained in:
Cat /dev/Nulo 2023-02-19 13:10:57 -03:00
parent 3cec0dc87f
commit d05519992d
2 changed files with 8 additions and 1 deletions

View file

@ -2,6 +2,7 @@ import assert from "node:assert";
import { join } from "node:path";
import { Alpine } from "../../alpine.js";
import { Runit } from "../../runit/index.js";
import { FluentBitParser, runitLokiLogger } from "../../software/fluentbit.js";
import { loadGrafanaSecretsFile } from "./secrets.js";
const provisioningDir = "/etc/grafana/provisioning/";
@ -63,7 +64,8 @@ export GRAFANA_HOME=/var/lib/grafana
cd "$GRAFANA_HOME"
exec chpst -u grafana:grafana grafana-server -config /etc/grafana.ini -homepath /usr/share/grafana
`
`,
runitLokiLogger(FluentBitParser.Logfmt, "grafana")
);
}

View file

@ -30,6 +30,7 @@ exec chpst -u nobody:nobody /usr/local/bin/fluent-bit \
export enum FluentBitParser {
Json = "json",
Logfmt = "logfmt",
// Raw toma todo lo que haya en una línea y lo guarda en `message`. No recomendado.
Raw = "raw",
@ -43,6 +44,10 @@ async function saveParsers(alpine: Alpine): Promise<void> {
parsersPath,
// https://rubular.com/
`
[PARSER]
name logfmt
format logfmt
[PARSER]
name raw
format regex