add rule definition with minimal dsl

This commit is contained in:
JOLIMAITRE Matthieu 2024-08-07 11:59:58 +02:00
parent fa524a5976
commit 084c5a2574
5 changed files with 48 additions and 15 deletions

View file

@ -1,10 +1,11 @@
#!/bin/env -S deno run
import { extr } from "./mod.ts"
import { def } from "./mod.ts"
const date = ["month", " ", "day", " ", "h", ":", "m", ":", "s"] as const;
const service = extr("", ...date, " ", "device", " ", "service", "[", "pid", "]: ", "line");
const kernel_ = extr("", ...date, " ", "device", " kernel: ", "line");
const date = "{{month}} {{day}} {{h}}:{{m}}:{{s}}" as const;
const service = def(`${date} {{device}} {{service}}[{{pid}}]: {{line}}`);
const kernel_ = def(`${date} {{device}} kernel: {{line}}`);
const lines = [
"août 06 09:25:18 navis systemd[1]: Finished Load Kernel Module configfs.",