ntpsec: loggear a loki

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

View file

@ -1,6 +1,7 @@
import { Alpine } from "../alpine.js";
import { sudoWriteFile } from "../helpers/sudo.js";
import { Runit } from "../runit/index.js";
import { FluentBitParser, runitLokiLogger } from "../software/fluentbit.js";
export async function setupNtpsec(alpine: Alpine, runit: Runit) {
await alpine.addPackages(["ntpsec"]);
@ -48,6 +49,7 @@ server gps.ntp.br nts iburst
"ntpsec",
`#!/bin/sh
exec ntpd --nice --nofork --panicgate
`
`,
runitLokiLogger(FluentBitParser.Ntpsec, "ntpsec")
);
}

View file

@ -34,6 +34,7 @@ export enum FluentBitParser {
Raw = "raw",
Forgejo = "forgejo",
Ntpsec = "ntpsec",
}
async function saveParsers(alpine: Alpine): Promise<void> {
@ -51,6 +52,11 @@ async function saveParsers(alpine: Alpine): Promise<void> {
name forgejo
format regex
regex ^((?<time>\\d{4}\\/\\d{2}\\/\\d{2} \\d{2}:\\d{2}:\\d{2}?) )?((?<trace>.+:.+:.+\\(\\)?) \\[(?<level>.?)\\] )?(?<message>.*?)$
[PARSER]
name ntpsec
format regex
regex ^(?<time>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}) (?<process>.+\\[\\d+\\]): (?<component>\\w+): (?<message>.+)$
`
);
}