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 { Alpine } from "../alpine.js";
import { Runit } from "../runit/index.js"; import { Runit } from "../runit/index.js";
import { FluentBitParser, runitLokiLogger } from "../software/fluentbit.js";
export async function setupDhcpcd(alpine: Alpine, runit: Runit) { export async function setupDhcpcd(alpine: Alpine, runit: Runit) {
await alpine.addPackages(["dhcpcd"]); await alpine.addPackages(["dhcpcd"]);
@ -10,7 +11,8 @@ export async function setupDhcpcd(alpine: Alpine, runit: Runit) {
await runit.addService( await runit.addService(
"dhcpcd", "dhcpcd",
`#!/bin/sh `#!/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", Forgejo = "forgejo",
Ntpsec = "ntpsec", Ntpsec = "ntpsec",
Dhcpcd = "dhcpcd",
} }
async function saveParsers(alpine: Alpine): Promise<void> { async function saveParsers(alpine: Alpine): Promise<void> {
@ -62,6 +63,11 @@ async function saveParsers(alpine: Alpine): Promise<void> {
name ntpsec name ntpsec
format regex format regex
regex ^(?<time>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}) (?<process>.+\\[\\d+\\]): (?<component>\\w+): (?<message>.+)$ 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>.+)$
` `
); );
} }