dhcpcd: loggear a loki

This commit is contained in:
Cat /dev/Nulo 2023-02-19 13:19:42 -03:00
parent d05519992d
commit c7469d5818
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,6 @@
import { Alpine } from "../alpine.js";
import { Runit } from "../runit/index.js";
import { FluentBitParser, runitLokiLogger } from "../software/fluentbit.js";
export async function setupDhcpcd(alpine: Alpine, runit: Runit) {
await alpine.addPackages(["dhcpcd"]);
@ -10,7 +11,8 @@ export async function setupDhcpcd(alpine: Alpine, runit: Runit) {
await runit.addService(
"dhcpcd",
`#!/bin/sh
exec dhcpcd --nobackground
`
exec dhcpcd --nobackground 2>&1
`,
runitLokiLogger(FluentBitParser.Dhcpcd, "dhcpcd")
);
}

View file

@ -36,6 +36,7 @@ export enum FluentBitParser {
Forgejo = "forgejo",
Ntpsec = "ntpsec",
Dhcpcd = "dhcpcd",
}
async function saveParsers(alpine: Alpine): Promise<void> {
@ -62,6 +63,11 @@ async function saveParsers(alpine: Alpine): Promise<void> {
name ntpsec
format regex
regex ^(?<time>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}) (?<process>.+\\[\\d+\\]): (?<component>\\w+): (?<message>.+)$
[PARSER]
name dhcpcd
format regex
regex ^((?<interface>\\w+): )?(?<message>.+)$
`
);
}