kiosko-plugin-logs 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +249 -2
- package/dist/index.js +1750 -0
- package/docs/last-error.png +0 -0
- package/docs/rate.png +0 -0
- package/docs/tail.png +0 -0
- package/kiosko-manifest.json +1600 -0
- package/package.json +70 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1750 @@
|
|
|
1
|
+
import { createRequire as __pluginRequire } from 'node:module'; const require = __pluginRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { definePlugin } from "@kiosko/sdk";
|
|
5
|
+
|
|
6
|
+
// src/i18n.ts
|
|
7
|
+
var L = (en, es, de, hans, hant) => ({ en, es, de, "zh-Hans": hans, "zh-Hant": hant });
|
|
8
|
+
var LANGUAGES = ["en", "es", "de", "zh-Hant", "zh-Hans"];
|
|
9
|
+
|
|
10
|
+
// src/sources.ts
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { defineSource, t } from "@kiosko/sdk";
|
|
14
|
+
|
|
15
|
+
// src/mask.ts
|
|
16
|
+
var MASK = "***";
|
|
17
|
+
var SECRET_KEY = String.raw`(?:pass(?:word|wd|phrase)?|pwd|secret|client[_-]?secret|token|access[_-]?token|refresh[_-]?token|id[_-]?token|auth[_-]?token|api[_-]?key|apikey|access[_-]?key|secret[_-]?key|private[_-]?key|session(?:[_-]?id)?|sessid|cookie|set-cookie|x-api-key|signature|sig|credentials?)`;
|
|
18
|
+
var RULES = [
|
|
19
|
+
// -----BEGIN … PRIVATE KEY----- blocks (one line once joined).
|
|
20
|
+
[/-----BEGIN [A-Z ]*PRIVATE KEY-----.*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g, `${MASK} private key ${MASK}`],
|
|
21
|
+
// scheme://user:password@host → scheme://user:***@host
|
|
22
|
+
[/\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@'"]*):[^\s@/'"]+@/gi, (_m, pre) => `${pre}:${MASK}@`],
|
|
23
|
+
// Authorization: Bearer xyz / Basic xyz / token xyz
|
|
24
|
+
// (only what looks like a credential: 8 characters or more, with a digit, a symbol or a lower-upper pair in it)
|
|
25
|
+
[/\b([Bb]earer|BEARER|[Bb]asic|BASIC|[Dd]igest)(\s+)(?=[A-Za-z0-9._~+/=-]*(?:[0-9._~+/=-]|[a-z][A-Z]))[A-Za-z0-9._~+/=-]{8,}/g, (_m, scheme, sp) => `${scheme}${sp}${MASK}`],
|
|
26
|
+
[/\b(authorization\s*[:=]\s*token)(\s+)\S+/gi, (_m, pre, sp) => `${pre}${sp}${MASK}`],
|
|
27
|
+
// "password": "…" (JSON, with or without escaped quotes)
|
|
28
|
+
[new RegExp(String.raw`((?:\\?["'])${SECRET_KEY}(?:\\?["'])\s*:\s*(?:\\?["']))(?:[^"'\\]|\\(?!["']))*`, "gi"), (_m, pre) => `${pre}${MASK}`],
|
|
29
|
+
// password=…, token: …, ?api_key=…&
|
|
30
|
+
[new RegExp(String.raw`(\b[\w.-]*${SECRET_KEY}\b\s*[=:]\s*)(?!${MASK.replace(/\*/g, "\\*")})("[^"]*"|'[^']*'|[^\s&,;"'<>)\]}]+)`, "gi"), (_m, pre) => `${pre}${MASK}`],
|
|
31
|
+
// Well-known token formats, wherever they are.
|
|
32
|
+
[/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|gl(?:dt|rt|soat|ptt)-[A-Za-z0-9_-]{16,}|xox[abprs]-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|sk-(?:ant-|proj-|live_|test_)?[A-Za-z0-9_-]{20,}|[rp]k_(?:live|test)_[A-Za-z0-9]{16,}|hf_[A-Za-z0-9]{30,}|npm_[A-Za-z0-9]{36})\b/g, MASK],
|
|
33
|
+
// JSON Web Tokens: three base64url parts, the first two starting with {" encoded.
|
|
34
|
+
[/\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g, MASK],
|
|
35
|
+
// E-mail addresses.
|
|
36
|
+
[/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}\b/g, `${MASK}@${MASK}`]
|
|
37
|
+
];
|
|
38
|
+
function mask(line) {
|
|
39
|
+
let out = line;
|
|
40
|
+
for (const [re, by] of RULES) out = out.replace(re, by);
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/types.ts
|
|
45
|
+
var LEVELS = ["error", "warning", "notice", "info", "debug"];
|
|
46
|
+
var rank = (l) => LEVELS.indexOf(l);
|
|
47
|
+
var MAX_MESSAGE = 400;
|
|
48
|
+
|
|
49
|
+
// src/buffer.ts
|
|
50
|
+
var MAX_LINES = 300;
|
|
51
|
+
var MAX_ALERTS = 1e3;
|
|
52
|
+
var ALERTS_MS = 24 * 36e5;
|
|
53
|
+
var LOOKBACK = 8;
|
|
54
|
+
var GROUP_GAP_MS = 15 * 6e4;
|
|
55
|
+
var ALERT_SPAN_MS = 6e4;
|
|
56
|
+
var same = (a, e) => a.msg === e.msg && a.unit === e.unit && a.level === e.level;
|
|
57
|
+
function addTo(list, line, max, spanMs = Infinity) {
|
|
58
|
+
for (let i = list.length - 1; i >= Math.max(0, list.length - LOOKBACK); i--) {
|
|
59
|
+
const old = list[i];
|
|
60
|
+
if (same(old, line) && Math.abs(line.t - old.t) <= GROUP_GAP_MS && Math.max(old.t, line.t) - Math.min(old.first, line.first) < spanMs) {
|
|
61
|
+
list.splice(i, 1);
|
|
62
|
+
list.push({ ...old, t: Math.max(old.t, line.t), first: Math.min(old.first, line.first), count: old.count + line.count });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
list.push(line);
|
|
67
|
+
if (list.length > max) list.splice(0, list.length - max);
|
|
68
|
+
}
|
|
69
|
+
var LogBuffer = class {
|
|
70
|
+
lines = [];
|
|
71
|
+
alerts = [];
|
|
72
|
+
kind;
|
|
73
|
+
maxLines;
|
|
74
|
+
maxAlerts;
|
|
75
|
+
alertsMs;
|
|
76
|
+
constructor(kind, o = {}) {
|
|
77
|
+
this.kind = kind;
|
|
78
|
+
this.maxLines = o.maxLines ?? MAX_LINES;
|
|
79
|
+
this.maxAlerts = o.maxAlerts ?? MAX_ALERTS;
|
|
80
|
+
this.alertsMs = o.alertsMs ?? ALERTS_MS;
|
|
81
|
+
}
|
|
82
|
+
/** A line as read: masked, then kept (and, if a warning or worse, kept longer). */
|
|
83
|
+
add(e) {
|
|
84
|
+
const msg = mask(e.msg);
|
|
85
|
+
if (!msg) return;
|
|
86
|
+
const line = { t: e.t, first: e.t, count: 1, level: e.level, kind: this.kind, unit: mask(e.unit), msg };
|
|
87
|
+
addTo(this.lines, line, this.maxLines);
|
|
88
|
+
if (rank(e.level) <= rank("warning")) {
|
|
89
|
+
addTo(this.alerts, line, this.maxAlerts, ALERT_SPAN_MS);
|
|
90
|
+
const cut = e.t - this.alertsMs;
|
|
91
|
+
if (this.alerts[0] && this.alerts[0].t < cut) this.alerts = this.alerts.filter((a) => a.t >= cut);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** What the widgets get: copies of the lists, and the status. */
|
|
95
|
+
snapshot(status) {
|
|
96
|
+
return { kind: this.kind, lines: this.lines.slice(), alerts: this.alerts.slice(), status };
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function throttle(fn, gapMs = 1e3, clock = Date.now) {
|
|
100
|
+
let last2 = -Infinity;
|
|
101
|
+
let timer;
|
|
102
|
+
let stopped = false;
|
|
103
|
+
const run = () => {
|
|
104
|
+
timer = void 0;
|
|
105
|
+
if (stopped) return;
|
|
106
|
+
last2 = clock();
|
|
107
|
+
fn();
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
schedule() {
|
|
111
|
+
if (stopped || timer) return;
|
|
112
|
+
const wait = last2 + gapMs - clock();
|
|
113
|
+
if (wait <= 0) run();
|
|
114
|
+
else timer = setTimeout(run, wait);
|
|
115
|
+
},
|
|
116
|
+
cancel() {
|
|
117
|
+
stopped = true;
|
|
118
|
+
if (timer) clearTimeout(timer);
|
|
119
|
+
timer = void 0;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/demo.ts
|
|
125
|
+
var JOURNAL = [
|
|
126
|
+
[3300, "info", "backup.service", "Starting nightly backup of /srv/shop"],
|
|
127
|
+
[3290, "error", "backup.service", "Fatal: unable to open repository at sftp://backup:Winter2026@nas.example.lan/shop: connection refused"],
|
|
128
|
+
[3289, "warning", "backup.service", "backup.service: Failed with result 'exit-code'."],
|
|
129
|
+
[2400, "info", "certbot.service", "Certificate for shop.example.com is not due for renewal"],
|
|
130
|
+
[1500, "notice", "sshd", "Accepted publickey for deploy from 192.0.2.44 port 52814"],
|
|
131
|
+
[1260, "warning", "postgresql", "checkpoints are occurring too frequently (24 seconds apart)"],
|
|
132
|
+
[1200, "error", "nginx.service", "upstream timed out (110: Connection timed out) while reading response header from upstream"],
|
|
133
|
+
[610, "info", "cron", "(root) CMD (/usr/local/bin/rotate-thumbnails)"],
|
|
134
|
+
[420, "warning", "smartd", "Device: /dev/sda [SAT], 8 Currently unreadable (pending) sectors"],
|
|
135
|
+
[300, "info", "nginx.service", "POST /api/hooks/stock?token=demo-abc123 401"],
|
|
136
|
+
[180, "notice", "systemd", "Started shop-worker.service - Shop background jobs."],
|
|
137
|
+
[95, "info", "shop-worker", "Password reset mail queued for ana.garcia@example.com"],
|
|
138
|
+
[64, "debug", "shop-worker", "cache warmed: 1 240 products in 3.1 s"]
|
|
139
|
+
];
|
|
140
|
+
var BURST = { from: 150, to: 6, every: 4, line: ["error", "nginx.service", "upstream timed out (110: Connection timed out) while reading response header from upstream"] };
|
|
141
|
+
var DOCKER = [
|
|
142
|
+
[900, "info", "shop-web", "Listening on http://0.0.0.0:8080"],
|
|
143
|
+
[700, "warning", "shop-worker", "Job 4711 took 38 s (limit 30 s)"],
|
|
144
|
+
[520, "info", "redis", "Background saving terminated with success"],
|
|
145
|
+
[240, "error", "shop-worker", "PaymentGatewayError: card_declined for order 10234"],
|
|
146
|
+
[40, "info", "shop-web", "GET /products/blue-mug 200 12 ms"],
|
|
147
|
+
[12, "info", "shop-web", "GET /cart 200 8 ms"]
|
|
148
|
+
];
|
|
149
|
+
var FILE = [
|
|
150
|
+
[1800, "info", "shop.log", "Imported 312 products from supplier feed"],
|
|
151
|
+
[880, "warning", "shop.log", "Supplier feed answered in 9.8 s"],
|
|
152
|
+
[30, "info", "shop.log", "Order 10235 paid (3 items)"]
|
|
153
|
+
];
|
|
154
|
+
var MACOS = [
|
|
155
|
+
[600, "info", "com.apple.TimeMachine", "Backup completed successfully"],
|
|
156
|
+
[200, "error", "diskarbitrationd", 'Unable to mount disk "Photos 2019": the disk is damaged'],
|
|
157
|
+
[20, "info", "com.apple.wifi", 'Joined network "Home"']
|
|
158
|
+
];
|
|
159
|
+
var WINDOWS = [
|
|
160
|
+
[1200, "warning", "DNS Client Events", "Name resolution for the name printer.example.lan timed out"],
|
|
161
|
+
[400, "error", "Service Control Manager", "The Print Spooler service terminated unexpectedly"],
|
|
162
|
+
[60, "info", "Microsoft-Windows-WindowsUpdateClient", "Installation successful: Security update for Windows"]
|
|
163
|
+
];
|
|
164
|
+
var KUBE = [
|
|
165
|
+
[500, "info", "shop-api-6d9f/api", "ready in 2.3 s"],
|
|
166
|
+
[90, "warning", "shop-api-6d9f/api", "slow request GET /search 1.9 s"]
|
|
167
|
+
];
|
|
168
|
+
function scattered(now) {
|
|
169
|
+
const out = [];
|
|
170
|
+
for (let m = 60; m >= 1; m--) {
|
|
171
|
+
const n = m >= 18 && m <= 22 ? 6 + m * 7 % 5 : m * 13 % 11 === 0 ? 2 : m * 5 % 7 === 0 ? 1 : 0;
|
|
172
|
+
for (let i = 0; i < n; i++) out.push({ t: now - m * 6e4 + i * 5e3, level: "error", unit: "nginx.service", msg: "upstream timed out (110: Connection timed out) while reading response header from upstream" });
|
|
173
|
+
if (m * 3 % 8 === 0) out.push({ t: now - m * 6e4 + 3e4, level: "warning", unit: "postgresql", msg: "checkpoints are occurring too frequently (24 seconds apart)" });
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
var SETS = { journal: JOURNAL, docker: DOCKER, file: FILE, macos: MACOS, windows: WINDOWS, kubernetes: KUBE };
|
|
178
|
+
function demoData(kind, now) {
|
|
179
|
+
const buf = new LogBuffer(kind);
|
|
180
|
+
const entries = (SETS[kind] ?? []).map(([ago, level, unit, msg]) => ({ t: now - ago * 1e3, level, unit, msg }));
|
|
181
|
+
if (kind === "journal") {
|
|
182
|
+
entries.push(...scattered(now));
|
|
183
|
+
for (let s = BURST.from; s >= BURST.to; s -= BURST.every) entries.push({ t: now - s * 1e3, level: BURST.line[0], unit: BURST.line[1], msg: BURST.line[2] });
|
|
184
|
+
}
|
|
185
|
+
for (const e of entries.sort((a, b) => a.t - b.t)) buf.add(e);
|
|
186
|
+
return buf.snapshot({ state: "following" });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/docker.ts
|
|
190
|
+
import { existsSync } from "node:fs";
|
|
191
|
+
import { request } from "node:http";
|
|
192
|
+
import { posix } from "node:path";
|
|
193
|
+
function defaultDockerSocket(o = {}) {
|
|
194
|
+
const env = o.env ?? process.env;
|
|
195
|
+
const platform = o.platform ?? process.platform;
|
|
196
|
+
const exists = o.exists ?? existsSync;
|
|
197
|
+
const host = env.DOCKER_HOST ?? "";
|
|
198
|
+
if (host.startsWith("unix://")) return host.slice("unix://".length);
|
|
199
|
+
if (host.startsWith("npipe://")) return host.slice("npipe://".length).replace(/\//g, "\\");
|
|
200
|
+
if (platform === "win32") return "\\\\.\\pipe\\docker_engine";
|
|
201
|
+
const candidates = [
|
|
202
|
+
env.XDG_RUNTIME_DIR ? posix.join(env.XDG_RUNTIME_DIR, "docker.sock") : "",
|
|
203
|
+
o.home ?? env.HOME ? posix.join(o.home ?? env.HOME, ".docker", "run", "docker.sock") : "",
|
|
204
|
+
"/var/run/docker.sock"
|
|
205
|
+
].filter(Boolean);
|
|
206
|
+
return candidates.find((p) => exists(p)) ?? "/var/run/docker.sock";
|
|
207
|
+
}
|
|
208
|
+
function socketError(socket, err) {
|
|
209
|
+
if (err.code === "ENOENT") return new Error(`Docker: no socket at ${socket}`);
|
|
210
|
+
if (err.code === "EACCES") return new Error(`Docker: no permission on ${socket} (the docker group, or rootless Docker)`);
|
|
211
|
+
if (err.code === "ECONNREFUSED") return new Error("Docker: not running");
|
|
212
|
+
return new Error(`Docker: ${err.message}`);
|
|
213
|
+
}
|
|
214
|
+
function dockerJson(socket, path, signal) {
|
|
215
|
+
return new Promise((resolve, reject) => {
|
|
216
|
+
const req = request({ socketPath: socket, path, method: "GET", headers: { Host: "docker" }, signal }, (res) => {
|
|
217
|
+
const chunks = [];
|
|
218
|
+
res.on("data", (c) => chunks.push(c));
|
|
219
|
+
res.on("end", () => {
|
|
220
|
+
const body = Buffer.concat(chunks).toString("utf8");
|
|
221
|
+
if ((res.statusCode ?? 500) >= 300) return reject(new Error(`Docker: ${res.statusCode} ${body.slice(0, 200).trim()}`));
|
|
222
|
+
try {
|
|
223
|
+
resolve(JSON.parse(body));
|
|
224
|
+
} catch {
|
|
225
|
+
reject(new Error("Docker: not JSON"));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
res.on("error", reject);
|
|
229
|
+
});
|
|
230
|
+
req.setTimeout(15e3, () => req.destroy(new Error("Docker: no answer in 15 s")));
|
|
231
|
+
req.on("error", (err) => reject(err.name === "AbortError" ? err : socketError(socket, err)));
|
|
232
|
+
req.end();
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function dockerStream(socket, path, signal, onChunk) {
|
|
236
|
+
return new Promise((resolve, reject) => {
|
|
237
|
+
const req = request({ socketPath: socket, path, method: "GET", headers: { Host: "docker" }, signal }, (res) => {
|
|
238
|
+
if ((res.statusCode ?? 500) >= 300) {
|
|
239
|
+
res.resume();
|
|
240
|
+
return reject(new Error(`Docker: ${res.statusCode} for ${path.split("?")[0]}`));
|
|
241
|
+
}
|
|
242
|
+
res.on("data", onChunk);
|
|
243
|
+
res.on("end", () => resolve());
|
|
244
|
+
res.on("error", (err) => signal.aborted ? resolve() : reject(err));
|
|
245
|
+
});
|
|
246
|
+
req.on("error", (err) => signal.aborted ? resolve() : reject(socketError(socket, err)));
|
|
247
|
+
req.end();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
async function listContainers(socket, signal) {
|
|
251
|
+
const list = await dockerJson(socket, "/containers/json", signal);
|
|
252
|
+
return list.map((c) => ({
|
|
253
|
+
id: c.Id,
|
|
254
|
+
name: (c.Names?.[0] ?? c.Id.slice(0, 12)).replace(/^\//, ""),
|
|
255
|
+
...c.Labels?.["com.docker.compose.service"] ? { service: c.Labels["com.docker.compose.service"] } : {},
|
|
256
|
+
...c.Labels?.["com.docker.compose.project"] ? { project: c.Labels["com.docker.compose.project"] } : {}
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
async function hasTty(socket, id, signal) {
|
|
260
|
+
const c = await dockerJson(socket, `/containers/${encodeURIComponent(id)}/json`, signal);
|
|
261
|
+
return !!c.Config?.Tty;
|
|
262
|
+
}
|
|
263
|
+
function logsPath(id, o) {
|
|
264
|
+
const q = new URLSearchParams({ follow: "1", stdout: "1", stderr: "1", timestamps: "1", tail: String(o.tail) });
|
|
265
|
+
if (o.since) q.set("since", (o.since / 1e3).toFixed(3));
|
|
266
|
+
return `/containers/${encodeURIComponent(id)}/logs?${q}`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/follow.ts
|
|
270
|
+
import { execFile } from "node:child_process";
|
|
271
|
+
import { basename } from "node:path";
|
|
272
|
+
import { matchFilter } from "@kiosko/sdk";
|
|
273
|
+
|
|
274
|
+
// src/follow-file.ts
|
|
275
|
+
import { open, stat } from "node:fs/promises";
|
|
276
|
+
import { StringDecoder } from "node:string_decoder";
|
|
277
|
+
|
|
278
|
+
// src/supervise.ts
|
|
279
|
+
import { spawn } from "node:child_process";
|
|
280
|
+
function sleep(ms, signal) {
|
|
281
|
+
return new Promise((resolve) => {
|
|
282
|
+
if (signal.aborted) return resolve();
|
|
283
|
+
const done = () => {
|
|
284
|
+
clearTimeout(timer);
|
|
285
|
+
signal.removeEventListener("abort", done);
|
|
286
|
+
resolve();
|
|
287
|
+
};
|
|
288
|
+
const timer = setTimeout(done, ms);
|
|
289
|
+
signal.addEventListener("abort", done, { once: true });
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
async function supervise(follow, o) {
|
|
293
|
+
const min = o.minMs ?? 1e3;
|
|
294
|
+
const max = o.maxMs ?? 6e4;
|
|
295
|
+
const healthy = o.healthyMs ?? 6e4;
|
|
296
|
+
const clock = o.clock ?? Date.now;
|
|
297
|
+
let wait = min;
|
|
298
|
+
while (!o.signal.aborted) {
|
|
299
|
+
const started = clock();
|
|
300
|
+
let why;
|
|
301
|
+
try {
|
|
302
|
+
await follow(o.signal);
|
|
303
|
+
why = "stopped";
|
|
304
|
+
} catch (err) {
|
|
305
|
+
why = err instanceof Error ? err.message : String(err);
|
|
306
|
+
}
|
|
307
|
+
if (o.signal.aborted) return;
|
|
308
|
+
if (clock() - started >= healthy) wait = min;
|
|
309
|
+
o.status({ state: "error", message: why });
|
|
310
|
+
o.log?.(`${why}; again in ${Math.round(wait / 1e3)} s`);
|
|
311
|
+
await sleep(wait, o.signal);
|
|
312
|
+
wait = Math.min(max, wait * 2);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function spawnError(cmd, err) {
|
|
316
|
+
if (err.code === "ENOENT") return new Error(`${cmd}: not found`);
|
|
317
|
+
if (err.code === "EACCES") return new Error(`${cmd}: permission denied`);
|
|
318
|
+
return new Error(`${cmd}: ${err.message}`);
|
|
319
|
+
}
|
|
320
|
+
function spawnLines(cmd, args, o) {
|
|
321
|
+
return new Promise((resolve, reject) => {
|
|
322
|
+
if (o.signal.aborted) return resolve();
|
|
323
|
+
let child;
|
|
324
|
+
try {
|
|
325
|
+
child = spawn(cmd, args, { stdio: ["ignore", "pipe", "pipe"], windowsHide: true, signal: o.signal, env: o.env ?? process.env });
|
|
326
|
+
} catch (err) {
|
|
327
|
+
return reject(spawnError(cmd, err));
|
|
328
|
+
}
|
|
329
|
+
let pending = "";
|
|
330
|
+
let said = "";
|
|
331
|
+
child.stdout.setEncoding("utf8");
|
|
332
|
+
child.stderr.setEncoding("utf8");
|
|
333
|
+
child.on("spawn", () => o.onStart?.());
|
|
334
|
+
child.stdout.on("data", (chunk) => {
|
|
335
|
+
const parts = (pending + chunk).split(/\r?\n/);
|
|
336
|
+
pending = parts.pop() ?? "";
|
|
337
|
+
if (pending.length > 1 << 20) pending = "";
|
|
338
|
+
for (const p of parts) if (p) o.onLine(p);
|
|
339
|
+
});
|
|
340
|
+
child.stderr.on("data", (chunk) => {
|
|
341
|
+
said = (said + chunk).slice(-600);
|
|
342
|
+
});
|
|
343
|
+
child.on("error", (err) => {
|
|
344
|
+
if (err.name === "AbortError") return resolve();
|
|
345
|
+
reject(spawnError(cmd, err));
|
|
346
|
+
});
|
|
347
|
+
child.on("close", (code, sig) => {
|
|
348
|
+
if (pending) o.onLine(pending);
|
|
349
|
+
if (o.signal.aborted) return resolve();
|
|
350
|
+
const last2 = said.trim().split(/\r?\n/).pop()?.trim();
|
|
351
|
+
if (code === 0) return reject(new Error(`${cmd} exited${last2 ? `: ${last2}` : ""}`));
|
|
352
|
+
reject(new Error(`${cmd} ${sig ? `was killed (${sig})` : `failed (${code})`}${last2 ? `: ${last2}` : ""}`));
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/follow-file.ts
|
|
358
|
+
var identity = (s) => ({ ino: s.ino, dev: s.dev, birth: Math.round(s.birthtimeMs) });
|
|
359
|
+
var replaced = (a, b) => a.dev !== b.dev || a.ino !== b.ino || a.ino === 0 && a.birth !== 0 && b.birth !== 0 && a.birth !== b.birth;
|
|
360
|
+
async function followFile(path, o) {
|
|
361
|
+
const pollMs = o.pollMs ?? 500;
|
|
362
|
+
const backlog = o.backlogBytes ?? 16384;
|
|
363
|
+
const chunk = o.chunkBytes ?? 1 << 20;
|
|
364
|
+
const skip = o.skipBytes ?? 8 << 20;
|
|
365
|
+
let fh = null;
|
|
366
|
+
let id = null;
|
|
367
|
+
let pos = 0;
|
|
368
|
+
let pending = "";
|
|
369
|
+
let decoder = new StringDecoder("utf8");
|
|
370
|
+
let first = true;
|
|
371
|
+
let waitingSaid = false;
|
|
372
|
+
const emitText = (text, final = false) => {
|
|
373
|
+
const parts = (pending + text).split(/\r?\n/);
|
|
374
|
+
pending = final ? "" : parts.pop() ?? "";
|
|
375
|
+
if (pending.length > 65536) {
|
|
376
|
+
parts.push(pending);
|
|
377
|
+
pending = "";
|
|
378
|
+
}
|
|
379
|
+
for (const p of parts) if (p.trim()) o.onLine(p);
|
|
380
|
+
};
|
|
381
|
+
const drain = async (size, final = false) => {
|
|
382
|
+
if (!fh) return;
|
|
383
|
+
if (size - pos > skip) {
|
|
384
|
+
o.onLine(`[kiosko: skipped ${Math.round((size - pos - backlog) / 1024)} KB of a fast-growing log]`);
|
|
385
|
+
pos = size - backlog;
|
|
386
|
+
pending = "";
|
|
387
|
+
decoder = new StringDecoder("utf8");
|
|
388
|
+
await dropPartialLine();
|
|
389
|
+
}
|
|
390
|
+
while (pos < size && !o.signal.aborted) {
|
|
391
|
+
const n = Math.min(chunk, size - pos);
|
|
392
|
+
const buf = Buffer.alloc(n);
|
|
393
|
+
const { bytesRead } = await fh.read(buf, 0, n, pos);
|
|
394
|
+
if (!bytesRead) break;
|
|
395
|
+
pos += bytesRead;
|
|
396
|
+
emitText(decoder.write(buf.subarray(0, bytesRead)));
|
|
397
|
+
if (n === chunk) break;
|
|
398
|
+
}
|
|
399
|
+
if (final) emitText(decoder.end(), true);
|
|
400
|
+
};
|
|
401
|
+
const dropPartialLine = async () => {
|
|
402
|
+
if (!fh || pos === 0) return;
|
|
403
|
+
const buf = Buffer.alloc(Math.min(4096, backlog));
|
|
404
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, pos);
|
|
405
|
+
const nl = buf.subarray(0, bytesRead).indexOf(10);
|
|
406
|
+
if (nl >= 0) pos += nl + 1;
|
|
407
|
+
};
|
|
408
|
+
const close = async () => {
|
|
409
|
+
const f = fh;
|
|
410
|
+
fh = null;
|
|
411
|
+
await f?.close().catch(() => void 0);
|
|
412
|
+
};
|
|
413
|
+
try {
|
|
414
|
+
while (!o.signal.aborted) {
|
|
415
|
+
if (!fh) {
|
|
416
|
+
try {
|
|
417
|
+
fh = await open(path, "r");
|
|
418
|
+
const st = await fh.stat();
|
|
419
|
+
if (st.isDirectory()) throw Object.assign(new Error(`${path}: is a folder`), { code: "EISDIR" });
|
|
420
|
+
id = identity(st);
|
|
421
|
+
pos = first ? Math.max(0, st.size - backlog) : 0;
|
|
422
|
+
pending = "";
|
|
423
|
+
decoder = new StringDecoder("utf8");
|
|
424
|
+
if (first) await dropPartialLine();
|
|
425
|
+
first = false;
|
|
426
|
+
waitingSaid = false;
|
|
427
|
+
o.status({ state: "following" });
|
|
428
|
+
} catch (err) {
|
|
429
|
+
await close();
|
|
430
|
+
const e = err;
|
|
431
|
+
if (e.code === "ENOENT") {
|
|
432
|
+
if (!waitingSaid) o.status({ state: "waiting", message: `${path}: not there yet` });
|
|
433
|
+
waitingSaid = true;
|
|
434
|
+
first = false;
|
|
435
|
+
await sleep(pollMs, o.signal);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
if (e.code === "EACCES" || e.code === "EPERM") throw new Error(`${path}: permission denied`);
|
|
439
|
+
throw e;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const now = await fh.stat();
|
|
443
|
+
if (now.size < pos) {
|
|
444
|
+
pos = 0;
|
|
445
|
+
pending = "";
|
|
446
|
+
decoder = new StringDecoder("utf8");
|
|
447
|
+
}
|
|
448
|
+
await drain(now.size);
|
|
449
|
+
let renamed = false;
|
|
450
|
+
try {
|
|
451
|
+
renamed = replaced(id, identity(await stat(path)));
|
|
452
|
+
} catch (err) {
|
|
453
|
+
renamed = err.code === "ENOENT";
|
|
454
|
+
}
|
|
455
|
+
if (renamed) {
|
|
456
|
+
await drain((await fh.stat()).size, true);
|
|
457
|
+
await close();
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
await sleep(pollMs, o.signal);
|
|
461
|
+
}
|
|
462
|
+
} finally {
|
|
463
|
+
await close();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/parse.ts
|
|
468
|
+
function levelFromPriority(p) {
|
|
469
|
+
if (!Number.isFinite(p)) return "info";
|
|
470
|
+
if (p <= 3) return "error";
|
|
471
|
+
if (p === 4) return "warning";
|
|
472
|
+
if (p === 5) return "notice";
|
|
473
|
+
if (p === 6) return "info";
|
|
474
|
+
return "debug";
|
|
475
|
+
}
|
|
476
|
+
function levelFromWord(w) {
|
|
477
|
+
if (!w) return null;
|
|
478
|
+
const s = String(w).trim().toLowerCase();
|
|
479
|
+
if (/^(e|err|error|errors|fatal|f|crit|critical|panic|emerg|emergency|alert|severe|failure|fault|c)$/.test(s)) return "error";
|
|
480
|
+
if (/^(w|warn|warning|warnings)$/.test(s)) return "warning";
|
|
481
|
+
if (/^(n|notice)$/.test(s)) return "notice";
|
|
482
|
+
if (/^(i|info|information|informational|default|log)$/.test(s)) return "info";
|
|
483
|
+
if (/^(d|debug|trace|t|verbose|v|fine|finer|finest|dbg)$/.test(s)) return "debug";
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
var ANSI = /\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b[@-_]/g;
|
|
487
|
+
var CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f]/g;
|
|
488
|
+
function cleanMessage(s) {
|
|
489
|
+
const one = s.replace(ANSI, "").replace(CONTROL, " ").replace(/\s+/g, " ").trim();
|
|
490
|
+
if (one.length <= MAX_MESSAGE) return one;
|
|
491
|
+
return `${[...one].slice(0, MAX_MESSAGE - 1).join("")}\u2026`;
|
|
492
|
+
}
|
|
493
|
+
var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
494
|
+
function leadingTime(s, now) {
|
|
495
|
+
const iso = /^\[?(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}:\d{2})(?:[.,](\d{1,9}))?\s?(Z|[+-]\d{2}:?\d{2})?\]?\s*/.exec(s);
|
|
496
|
+
if (iso) {
|
|
497
|
+
const frac = iso[3] ? `.${iso[3].slice(0, 3).padEnd(3, "0")}` : "";
|
|
498
|
+
const zone = iso[4] ? iso[4] === "Z" ? "Z" : iso[4].replace(/^([+-]\d{2})(\d{2})$/, "$1:$2") : "";
|
|
499
|
+
const t3 = Date.parse(`${iso[1]}T${iso[2]}${frac}${zone}`);
|
|
500
|
+
if (Number.isFinite(t3)) return { t: t3, len: iso[0].length };
|
|
501
|
+
}
|
|
502
|
+
const sys = /^([A-Z][a-z]{2}) {1,2}(\d{1,2}) (\d{2}):(\d{2}):(\d{2})\s+/.exec(s);
|
|
503
|
+
if (sys) {
|
|
504
|
+
const m = MONTHS.indexOf(sys[1].toLowerCase());
|
|
505
|
+
if (m >= 0) {
|
|
506
|
+
const year = new Date(now).getFullYear();
|
|
507
|
+
let t3 = new Date(year, m, Number(sys[2]), Number(sys[3]), Number(sys[4]), Number(sys[5])).getTime();
|
|
508
|
+
if (t3 - now > 2 * 864e5) t3 = new Date(year - 1, m, Number(sys[2]), Number(sys[3]), Number(sys[4]), Number(sys[5])).getTime();
|
|
509
|
+
return { t: t3, len: sys[0].length };
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
function fromJsonLine(o) {
|
|
515
|
+
const pick = (...keys) => {
|
|
516
|
+
for (const k of keys) if (o[k] !== void 0 && o[k] !== null && o[k] !== "") return o[k];
|
|
517
|
+
return void 0;
|
|
518
|
+
};
|
|
519
|
+
const msg = pick("msg", "message", "MESSAGE", "log", "text", "event");
|
|
520
|
+
if (msg === void 0) return null;
|
|
521
|
+
const lv = pick("level", "lvl", "severity", "loglevel", "log.level", "levelname", "status");
|
|
522
|
+
const level = typeof lv === "number" ? lv >= 50 ? "error" : lv >= 40 ? "warning" : lv >= 30 ? "info" : "debug" : levelFromWord(lv);
|
|
523
|
+
const ts = pick("time", "ts", "timestamp", "@timestamp", "datetime", "date");
|
|
524
|
+
let t3;
|
|
525
|
+
if (typeof ts === "number") t3 = ts > 1e12 ? ts : ts * 1e3;
|
|
526
|
+
else if (typeof ts === "string") {
|
|
527
|
+
const p = Date.parse(ts);
|
|
528
|
+
if (Number.isFinite(p)) t3 = p;
|
|
529
|
+
}
|
|
530
|
+
const unit = pick("logger", "name", "service", "component", "module");
|
|
531
|
+
return { ...t3 !== void 0 ? { t: t3 } : {}, ...level ? { level } : {}, ...typeof unit === "string" ? { unit } : {}, msg: typeof msg === "string" ? msg : JSON.stringify(msg) };
|
|
532
|
+
}
|
|
533
|
+
var LV = "emerg|emergency|alert|crit|critical|fatal|panic|severe|error|err|warning|warn|notice|info|debug|trace";
|
|
534
|
+
var FIRST_WORD = new RegExp(String.raw`^(?:[\w.-]+\s+\|\s+)?[[(<]?(${LV})\b[\])>]?:?\s`, "i");
|
|
535
|
+
var LATER_WORD = new RegExp(String.raw`^(?:\S+\s+){1,4}?(?:\[(${LV})\]|<(${LV})>|(${LV}):\s|(${LV.toUpperCase()})\b)`, "i");
|
|
536
|
+
function parseText(line, now, fallback = "info") {
|
|
537
|
+
let s = line.replace(ANSI, "").trim();
|
|
538
|
+
if (s.startsWith("{") && s.endsWith("}")) {
|
|
539
|
+
try {
|
|
540
|
+
const j = fromJsonLine(JSON.parse(s));
|
|
541
|
+
if (j?.msg !== void 0) return { t: j.t ?? now, level: j.level ?? fallback, ...j.unit ? { unit: j.unit } : {}, msg: cleanMessage(j.msg) };
|
|
542
|
+
} catch {
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
let t3 = now;
|
|
546
|
+
let unit;
|
|
547
|
+
const lead = leadingTime(s, now);
|
|
548
|
+
if (lead) {
|
|
549
|
+
t3 = lead.t;
|
|
550
|
+
s = s.slice(lead.len);
|
|
551
|
+
const prog = /^\S+ ([\w./@-]+?)(?:\[\d+\])?: /.exec(s);
|
|
552
|
+
if (prog && !levelFromWord(prog[1])) {
|
|
553
|
+
unit = prog[1];
|
|
554
|
+
s = s.slice(prog[0].length);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const lf = /(?:^|\s)(?:level|lvl|severity)=("?)(\w+)\1/.exec(s);
|
|
558
|
+
let level = lf ? levelFromWord(lf[2]) : null;
|
|
559
|
+
if (lf) {
|
|
560
|
+
const m = /(?:^|\s)(?:msg|message)=(?:"((?:[^"\\]|\\.)*)"|(\S+))/.exec(s);
|
|
561
|
+
if (m) s = (m[1] ?? m[2] ?? s).replace(/\\"/g, '"');
|
|
562
|
+
}
|
|
563
|
+
if (!level) {
|
|
564
|
+
const first = FIRST_WORD.exec(`${s} `);
|
|
565
|
+
const later = first ?? LATER_WORD.exec(s);
|
|
566
|
+
const upper = later && !first && later[4] && later[4] !== later[4].toUpperCase() ? null : later;
|
|
567
|
+
const word = upper ? upper[1] ?? upper[2] ?? upper[3] ?? upper[4] : void 0;
|
|
568
|
+
if (word) level = levelFromWord(word);
|
|
569
|
+
if (first && level && !/\|/.test(first[0])) s = s.slice(Math.min(s.length, first[0].length));
|
|
570
|
+
else {
|
|
571
|
+
const glog = /^([EWIF])\d{4} \d{2}:\d{2}:\d{2}/.exec(s);
|
|
572
|
+
if (glog) level = levelFromWord(glog[1] === "F" ? "fatal" : glog[1]);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return { t: t3, level: level ?? fallback, ...unit ? { unit } : {}, msg: cleanMessage(s) };
|
|
576
|
+
}
|
|
577
|
+
function journalText(v) {
|
|
578
|
+
if (typeof v === "string") return v;
|
|
579
|
+
if (Array.isArray(v) && v.every((x) => typeof x === "number")) return Buffer.from(v).toString("utf8");
|
|
580
|
+
return void 0;
|
|
581
|
+
}
|
|
582
|
+
function parseJournalRecord(line) {
|
|
583
|
+
let o;
|
|
584
|
+
try {
|
|
585
|
+
o = JSON.parse(line);
|
|
586
|
+
} catch {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
if (!o || typeof o !== "object") return null;
|
|
590
|
+
const msg = journalText(o.MESSAGE);
|
|
591
|
+
if (msg === void 0) return null;
|
|
592
|
+
const us = Number(o.__REALTIME_TIMESTAMP);
|
|
593
|
+
const t3 = Number.isFinite(us) ? Math.round(us / 1e3) : Date.now();
|
|
594
|
+
const sysUnit = journalText(o._SYSTEMD_UNIT);
|
|
595
|
+
const userUnit = journalText(o._SYSTEMD_USER_UNIT);
|
|
596
|
+
const ident = journalText(o.SYSLOG_IDENTIFIER);
|
|
597
|
+
const unit = userUnit ?? sysUnit ?? ident ?? journalText(o._COMM) ?? (o._TRANSPORT === "kernel" ? "kernel" : "journal");
|
|
598
|
+
const shown = unit === sysUnit && /^user@\d+\.service$/.test(unit) ? ident ?? unit : unit;
|
|
599
|
+
const prio = Number(journalText(o.PRIORITY) ?? 6);
|
|
600
|
+
const cursor = journalText(o.__CURSOR);
|
|
601
|
+
return {
|
|
602
|
+
entry: { t: t3, level: levelFromPriority(prio), unit: shown, msg: cleanMessage(msg) },
|
|
603
|
+
names: [sysUnit, userUnit, ident].filter((x) => !!x),
|
|
604
|
+
...cursor ? { cursor } : {}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
var DockerDemux = class {
|
|
608
|
+
buf = Buffer.alloc(0);
|
|
609
|
+
text = { stdout: "", stderr: "" };
|
|
610
|
+
raw;
|
|
611
|
+
constructor(raw = false) {
|
|
612
|
+
this.raw = raw;
|
|
613
|
+
}
|
|
614
|
+
/** Complete lines found in `chunk` (and what was pending), in order. */
|
|
615
|
+
push(chunk) {
|
|
616
|
+
const out = [];
|
|
617
|
+
if (this.raw) {
|
|
618
|
+
this.lines("stdout", chunk.toString("utf8"), out);
|
|
619
|
+
return out;
|
|
620
|
+
}
|
|
621
|
+
this.buf = this.buf.length ? Buffer.concat([this.buf, chunk]) : chunk;
|
|
622
|
+
while (this.buf.length >= 8) {
|
|
623
|
+
const kind = this.buf[0];
|
|
624
|
+
const size = this.buf.readUInt32BE(4);
|
|
625
|
+
if (kind > 2 || this.buf[1] !== 0 || this.buf[2] !== 0 || this.buf[3] !== 0) {
|
|
626
|
+
const rest = this.buf;
|
|
627
|
+
this.buf = Buffer.alloc(0);
|
|
628
|
+
this.raw = true;
|
|
629
|
+
this.lines("stdout", rest.toString("utf8"), out);
|
|
630
|
+
return out;
|
|
631
|
+
}
|
|
632
|
+
if (this.buf.length < 8 + size) break;
|
|
633
|
+
const payload = this.buf.subarray(8, 8 + size).toString("utf8");
|
|
634
|
+
this.buf = this.buf.subarray(8 + size);
|
|
635
|
+
this.lines(kind === 2 ? "stderr" : "stdout", payload, out);
|
|
636
|
+
}
|
|
637
|
+
return out;
|
|
638
|
+
}
|
|
639
|
+
lines(stream, text, out) {
|
|
640
|
+
const parts = (this.text[stream] + text).split(/\r?\n/);
|
|
641
|
+
this.text[stream] = parts.pop() ?? "";
|
|
642
|
+
if (this.text[stream].length > 65536) {
|
|
643
|
+
parts.push(this.text[stream]);
|
|
644
|
+
this.text[stream] = "";
|
|
645
|
+
}
|
|
646
|
+
for (const p of parts) if (p.trim()) out.push({ stream, line: p });
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
function splitDockerTimestamp(line) {
|
|
650
|
+
const m = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|[+-]\d{2}:\d{2}) /.exec(line);
|
|
651
|
+
if (!m) return { t: null, rest: line };
|
|
652
|
+
const t3 = Date.parse(`${m[1]}${(m[2] ?? "").slice(0, 4)}${m[3]}`);
|
|
653
|
+
return { t: Number.isFinite(t3) ? t3 : null, rest: line.slice(m[0].length) };
|
|
654
|
+
}
|
|
655
|
+
function parseMacos(line) {
|
|
656
|
+
let o;
|
|
657
|
+
try {
|
|
658
|
+
o = JSON.parse(line);
|
|
659
|
+
} catch {
|
|
660
|
+
return null;
|
|
661
|
+
}
|
|
662
|
+
if (!o || typeof o.eventMessage !== "string") return null;
|
|
663
|
+
const ts = typeof o.timestamp === "string" ? /^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)?([+-]\d{2})(\d{2})$/.exec(o.timestamp) : null;
|
|
664
|
+
const t3 = ts ? Date.parse(`${ts[1]}T${ts[2]}${(ts[3] ?? "").slice(0, 4)}${ts[4]}:${ts[5]}`) : Date.now();
|
|
665
|
+
const type = String(o.messageType ?? "").toLowerCase();
|
|
666
|
+
const level = type === "fault" || type === "error" ? "error" : type === "debug" ? "debug" : "info";
|
|
667
|
+
const image = typeof o.processImagePath === "string" ? o.processImagePath.split("/").pop() : void 0;
|
|
668
|
+
const unit = typeof o.subsystem === "string" && o.subsystem || image || "log";
|
|
669
|
+
return { t: Number.isFinite(t3) ? t3 : Date.now(), level, unit, msg: cleanMessage(o.eventMessage) };
|
|
670
|
+
}
|
|
671
|
+
function winTime(v) {
|
|
672
|
+
if (typeof v === "string") {
|
|
673
|
+
const m = /\/Date\((-?\d+)/.exec(v);
|
|
674
|
+
if (m) return Number(m[1]);
|
|
675
|
+
const p = Date.parse(v);
|
|
676
|
+
if (Number.isFinite(p)) return p;
|
|
677
|
+
}
|
|
678
|
+
if (v && typeof v === "object" && "value" in v) return winTime(v.value);
|
|
679
|
+
return Date.now();
|
|
680
|
+
}
|
|
681
|
+
function parseWindowsEvents(json) {
|
|
682
|
+
const text = json.trim();
|
|
683
|
+
if (!text) return [];
|
|
684
|
+
let v;
|
|
685
|
+
try {
|
|
686
|
+
v = JSON.parse(text);
|
|
687
|
+
} catch {
|
|
688
|
+
return [];
|
|
689
|
+
}
|
|
690
|
+
const list = Array.isArray(v) ? v : [v];
|
|
691
|
+
const out = [];
|
|
692
|
+
for (const e of list) {
|
|
693
|
+
if (!e || typeof e !== "object") continue;
|
|
694
|
+
const o = e;
|
|
695
|
+
const lv = Number(o.Level);
|
|
696
|
+
const level = lv === 1 || lv === 2 ? "error" : lv === 3 ? "warning" : lv === 5 ? "debug" : "info";
|
|
697
|
+
const msg = typeof o.Message === "string" && o.Message.trim() ? o.Message : `Event ${o.Id ?? "?"}`;
|
|
698
|
+
out.push({ t: winTime(o.TimeCreated), level, unit: String(o.ProviderName ?? o.LogName ?? "Windows"), msg: cleanMessage(msg), log: String(o.LogName ?? ""), record: Number(o.RecordId ?? 0) });
|
|
699
|
+
}
|
|
700
|
+
return out.sort((a, b) => a.t - b.t || a.record - b.record);
|
|
701
|
+
}
|
|
702
|
+
function parseKubeLine(line, now) {
|
|
703
|
+
let rest = line;
|
|
704
|
+
let unit = "kubernetes";
|
|
705
|
+
const p = /^\[([^\]]+)\] /.exec(rest);
|
|
706
|
+
if (p) {
|
|
707
|
+
unit = p[1].replace(/^pod\//, "");
|
|
708
|
+
rest = rest.slice(p[0].length);
|
|
709
|
+
}
|
|
710
|
+
const ts = splitDockerTimestamp(rest);
|
|
711
|
+
const r = parseText(ts.rest, ts.t ?? now);
|
|
712
|
+
return { t: ts.t ?? r.t, level: r.level, unit, msg: r.msg };
|
|
713
|
+
}
|
|
714
|
+
function parseLokiMessage(json, now) {
|
|
715
|
+
let v;
|
|
716
|
+
try {
|
|
717
|
+
v = JSON.parse(json);
|
|
718
|
+
} catch {
|
|
719
|
+
return [];
|
|
720
|
+
}
|
|
721
|
+
const out = [];
|
|
722
|
+
for (const s of v.streams ?? []) {
|
|
723
|
+
const labels = s.stream ?? {};
|
|
724
|
+
const unit = labels.service_name ?? labels.app ?? labels.container ?? labels.unit ?? labels.job ?? labels.filename?.split("/").pop() ?? "loki";
|
|
725
|
+
const labelled = levelFromWord(labels.level ?? labels.detected_level ?? labels.severity);
|
|
726
|
+
for (const [ns, text] of s.values ?? []) {
|
|
727
|
+
const t3 = Math.round(Number(ns) / 1e6);
|
|
728
|
+
const r = parseText(String(text), Number.isFinite(t3) ? t3 : now);
|
|
729
|
+
out.push({ t: Number.isFinite(t3) ? t3 : r.t, level: labelled ?? r.level, unit: r.unit ?? unit, msg: r.msg });
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return out.sort((a, b) => a.t - b.t);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// src/follow.ts
|
|
736
|
+
var PRIORITY = { error: 3, warning: 4, notice: 5, info: 6, debug: 7 };
|
|
737
|
+
function journalArgs(o, cursor) {
|
|
738
|
+
return ["--follow", "--output=json", cursor ? `--after-cursor=${cursor}` : "--lines=200", `--priority=${PRIORITY[o.priority] ?? 6}`, "--no-pager", "--quiet", ...o.onlyUser ? ["--user"] : []];
|
|
739
|
+
}
|
|
740
|
+
function followJournal(o, h) {
|
|
741
|
+
const bin = o.bin.trim() || "journalctl";
|
|
742
|
+
let cursor;
|
|
743
|
+
return supervise(
|
|
744
|
+
(signal) => spawnLines(bin, journalArgs(o, cursor), {
|
|
745
|
+
signal,
|
|
746
|
+
onStart: () => h.status({ state: "following" }),
|
|
747
|
+
onLine: (line) => {
|
|
748
|
+
const r = parseJournalRecord(line);
|
|
749
|
+
if (!r) return;
|
|
750
|
+
if (r.cursor) cursor = r.cursor;
|
|
751
|
+
if (!matchFilter([...r.names, r.entry.unit], o.units)) return;
|
|
752
|
+
h.add(r.entry);
|
|
753
|
+
}
|
|
754
|
+
}),
|
|
755
|
+
{ signal: h.signal, status: h.status, log: h.log }
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
function followFiles(paths, h) {
|
|
759
|
+
const states = /* @__PURE__ */ new Map();
|
|
760
|
+
const report = () => {
|
|
761
|
+
const all = [...states.values()];
|
|
762
|
+
const ok = all.filter((s) => s.state === "following").length;
|
|
763
|
+
const bad = all.find((s) => s.state !== "following");
|
|
764
|
+
h.status(ok ? { state: "following", ...bad ? { message: bad.message } : {} } : bad ?? { state: "waiting" });
|
|
765
|
+
};
|
|
766
|
+
return Promise.all(
|
|
767
|
+
paths.map((path) => {
|
|
768
|
+
const unit = basename(path);
|
|
769
|
+
const status = (s) => {
|
|
770
|
+
states.set(path, s);
|
|
771
|
+
report();
|
|
772
|
+
};
|
|
773
|
+
return supervise(
|
|
774
|
+
(signal) => followFile(path, {
|
|
775
|
+
signal,
|
|
776
|
+
status,
|
|
777
|
+
onLine: (line) => {
|
|
778
|
+
const e = parseText(line, Date.now());
|
|
779
|
+
h.add({ t: e.t, level: e.level, unit: e.unit ?? unit, msg: e.msg });
|
|
780
|
+
}
|
|
781
|
+
}),
|
|
782
|
+
{ signal: h.signal, status, log: (m) => h.log(`${unit}: ${m}`) }
|
|
783
|
+
);
|
|
784
|
+
})
|
|
785
|
+
).then(() => void 0);
|
|
786
|
+
}
|
|
787
|
+
var containerNames = (c) => [c.name, ...c.service ? [c.service] : [], ...c.project && c.service ? [`${c.project}/${c.service}`] : []];
|
|
788
|
+
function followDocker(o, h, rescanMs = 15e3) {
|
|
789
|
+
const followed = /* @__PURE__ */ new Map();
|
|
790
|
+
const lastSeen = /* @__PURE__ */ new Map();
|
|
791
|
+
const followOne = async (c, signal) => {
|
|
792
|
+
const tty = await hasTty(o.socket, c.id, signal);
|
|
793
|
+
const demux = new DockerDemux(tty);
|
|
794
|
+
const since = lastSeen.get(c.id);
|
|
795
|
+
await dockerStream(o.socket, logsPath(c.id, since ? { tail: 0, since } : { tail: 50 }), signal, (chunk) => {
|
|
796
|
+
for (const { line } of demux.push(chunk)) {
|
|
797
|
+
const { t: t3, rest } = splitDockerTimestamp(line);
|
|
798
|
+
if (since && t3 !== null && t3 <= since) continue;
|
|
799
|
+
const e = parseText(rest, t3 ?? Date.now());
|
|
800
|
+
if (t3 !== null) lastSeen.set(c.id, Math.max(lastSeen.get(c.id) ?? 0, t3));
|
|
801
|
+
h.add({ t: t3 ?? e.t, level: e.level, unit: c.name, msg: e.msg });
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
};
|
|
805
|
+
return supervise(
|
|
806
|
+
async (signal) => {
|
|
807
|
+
try {
|
|
808
|
+
while (!signal.aborted) {
|
|
809
|
+
const running = (await listContainers(o.socket, signal)).filter((c) => matchFilter(containerNames(c), o.containers));
|
|
810
|
+
const ids = new Set(running.map((c) => c.id));
|
|
811
|
+
for (const [id, ac] of followed) if (!ids.has(id)) ac.abort(), followed.delete(id);
|
|
812
|
+
for (const c of running) {
|
|
813
|
+
if (followed.has(c.id)) continue;
|
|
814
|
+
const ac = new AbortController();
|
|
815
|
+
followed.set(c.id, ac);
|
|
816
|
+
const s = AbortSignal.any([signal, ac.signal]);
|
|
817
|
+
followOne(c, s).catch((err) => !s.aborted && h.log(`${c.name}: ${err instanceof Error ? err.message : err}`)).finally(() => followed.get(c.id) === ac && followed.delete(c.id));
|
|
818
|
+
}
|
|
819
|
+
h.status(running.length ? { state: "following" } : { state: "waiting", message: "Docker: no running container matches" });
|
|
820
|
+
await sleep(rescanMs, signal);
|
|
821
|
+
}
|
|
822
|
+
} finally {
|
|
823
|
+
for (const ac of followed.values()) ac.abort();
|
|
824
|
+
followed.clear();
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
{ signal: h.signal, status: h.status, log: h.log }
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
function macosArgs(o) {
|
|
831
|
+
return ["stream", "--style", "ndjson", "--level", o.level, ...o.predicate.trim() ? ["--predicate", o.predicate.trim()] : []];
|
|
832
|
+
}
|
|
833
|
+
function followMacos(o, h) {
|
|
834
|
+
return supervise(
|
|
835
|
+
(signal) => spawnLines(o.bin.trim() || "/usr/bin/log", macosArgs(o), {
|
|
836
|
+
signal,
|
|
837
|
+
onStart: () => h.status({ state: "following" }),
|
|
838
|
+
onLine: (line) => {
|
|
839
|
+
const e = parseMacos(line);
|
|
840
|
+
if (e) h.add(e);
|
|
841
|
+
}
|
|
842
|
+
}),
|
|
843
|
+
{ signal: h.signal, status: h.status, log: h.log }
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
var WIN_LEVELS = { error: [1, 2], warning: [1, 2, 3], info: [0, 1, 2, 3, 4] };
|
|
847
|
+
function windowsScript(o, since, max = 200) {
|
|
848
|
+
const q = (s) => `'${s.replace(/'/g, "''")}'`;
|
|
849
|
+
const logs = (o.logs.length ? o.logs : ["System", "Application"]).map(q).join(",");
|
|
850
|
+
return [
|
|
851
|
+
"$ErrorActionPreference='SilentlyContinue'",
|
|
852
|
+
"[Console]::OutputEncoding=[Text.Encoding]::UTF8",
|
|
853
|
+
`$f=@{LogName=@(${logs});Level=@(${WIN_LEVELS[o.priority].join(",")});StartTime=[DateTimeOffset]::FromUnixTimeMilliseconds(${Math.floor(since)}).LocalDateTime}`,
|
|
854
|
+
`Get-WinEvent -FilterHashtable $f -MaxEvents ${max} | Select-Object TimeCreated,Id,Level,ProviderName,LogName,RecordId,Message | ConvertTo-Json -Compress -Depth 2`
|
|
855
|
+
].join("; ");
|
|
856
|
+
}
|
|
857
|
+
function followWindows(o, h, pollMs = 15e3) {
|
|
858
|
+
const bin = o.bin.trim() || "powershell.exe";
|
|
859
|
+
const seen = /* @__PURE__ */ new Set();
|
|
860
|
+
let since = Date.now() - 60 * 6e4;
|
|
861
|
+
const poll = (signal) => new Promise((resolve, reject) => {
|
|
862
|
+
const script = Buffer.from(windowsScript(o, since - 2e3), "utf16le").toString("base64");
|
|
863
|
+
execFile(bin, ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-EncodedCommand", script], { signal, windowsHide: true, maxBuffer: 16 << 20, timeout: 6e4 }, (err, stdout, stderr) => {
|
|
864
|
+
if (err && err.code === "ENOENT") return reject(new Error(`${bin}: not found`));
|
|
865
|
+
if (err && !stdout) return reject(new Error(`${bin}: ${String(stderr || err.message).trim().split(/\r?\n/).pop()}`));
|
|
866
|
+
resolve(stdout);
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
return supervise(
|
|
870
|
+
async (signal) => {
|
|
871
|
+
while (!signal.aborted) {
|
|
872
|
+
const events = parseWindowsEvents(await poll(signal));
|
|
873
|
+
h.status({ state: "following" });
|
|
874
|
+
for (const e of events) {
|
|
875
|
+
const key = `${e.log}:${e.record}`;
|
|
876
|
+
if (seen.has(key)) continue;
|
|
877
|
+
seen.add(key);
|
|
878
|
+
since = Math.max(since, e.t);
|
|
879
|
+
h.add(e);
|
|
880
|
+
}
|
|
881
|
+
if (seen.size > 5e3) seen.clear();
|
|
882
|
+
await sleep(pollMs, signal);
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
{ signal: h.signal, status: h.status, log: h.log }
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
function kubeArgs(o, since) {
|
|
889
|
+
const sel = o.selector.trim();
|
|
890
|
+
return [
|
|
891
|
+
"logs",
|
|
892
|
+
"--follow",
|
|
893
|
+
"--timestamps",
|
|
894
|
+
"--prefix",
|
|
895
|
+
"--all-containers",
|
|
896
|
+
"--max-log-requests=20",
|
|
897
|
+
since ? `--since-time=${new Date(since).toISOString()}` : "--tail=50",
|
|
898
|
+
...o.namespace.trim() ? ["--namespace", o.namespace.trim()] : [],
|
|
899
|
+
...o.context.trim() ? ["--context", o.context.trim()] : [],
|
|
900
|
+
...sel.includes("=") ? ["--selector", sel] : [sel]
|
|
901
|
+
];
|
|
902
|
+
}
|
|
903
|
+
function followKube(o, h) {
|
|
904
|
+
let last2 = 0;
|
|
905
|
+
return supervise(
|
|
906
|
+
(signal) => {
|
|
907
|
+
const since = last2;
|
|
908
|
+
return spawnLines(o.bin.trim() || "kubectl", kubeArgs(o, since || void 0), {
|
|
909
|
+
signal,
|
|
910
|
+
onStart: () => h.status({ state: "following" }),
|
|
911
|
+
onLine: (line) => {
|
|
912
|
+
const e = parseKubeLine(line, Date.now());
|
|
913
|
+
if (since && e.t <= since) return;
|
|
914
|
+
last2 = Math.max(last2, e.t);
|
|
915
|
+
h.add(e);
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
},
|
|
919
|
+
{ signal: h.signal, status: h.status, log: h.log }
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
function lokiTail(o, since) {
|
|
923
|
+
const u = new URL(o.url.trim().replace(/\/+$/, "") + "/loki/api/v1/tail");
|
|
924
|
+
u.protocol = u.protocol === "https:" ? "wss:" : "ws:";
|
|
925
|
+
const headers = {};
|
|
926
|
+
if (u.username) headers.Authorization = `Basic ${Buffer.from(`${decodeURIComponent(u.username)}:${decodeURIComponent(u.password)}`).toString("base64")}`;
|
|
927
|
+
u.username = "";
|
|
928
|
+
u.password = "";
|
|
929
|
+
if (o.token.trim()) headers.Authorization = `Bearer ${o.token.trim()}`;
|
|
930
|
+
if (o.orgId.trim()) headers["X-Scope-OrgID"] = o.orgId.trim();
|
|
931
|
+
u.searchParams.set("query", o.query.trim());
|
|
932
|
+
u.searchParams.set("limit", "100");
|
|
933
|
+
if (since) u.searchParams.set("start", `${Math.floor(since) + 1}000000`);
|
|
934
|
+
return { url: u.href, headers };
|
|
935
|
+
}
|
|
936
|
+
function followLoki(o, h) {
|
|
937
|
+
let last2 = 0;
|
|
938
|
+
return supervise(
|
|
939
|
+
(signal) => new Promise((resolve, reject) => {
|
|
940
|
+
const { url, headers } = lokiTail(o, last2 || void 0);
|
|
941
|
+
const WS = globalThis.WebSocket;
|
|
942
|
+
if (!WS) return reject(new Error("Loki: this Node has no WebSocket (22 or later needed)"));
|
|
943
|
+
const ws = new WS(url, { headers });
|
|
944
|
+
let opened = false;
|
|
945
|
+
const stop = () => ws.close();
|
|
946
|
+
signal.addEventListener("abort", stop, { once: true });
|
|
947
|
+
ws.onopen = () => {
|
|
948
|
+
opened = true;
|
|
949
|
+
h.status({ state: "following" });
|
|
950
|
+
};
|
|
951
|
+
ws.onmessage = (ev) => {
|
|
952
|
+
for (const e of parseLokiMessage(String(ev.data), Date.now())) {
|
|
953
|
+
last2 = Math.max(last2, e.t);
|
|
954
|
+
h.add(e);
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
ws.onerror = () => void 0;
|
|
958
|
+
ws.onclose = (ev) => {
|
|
959
|
+
signal.removeEventListener("abort", stop);
|
|
960
|
+
if (signal.aborted) return resolve();
|
|
961
|
+
reject(new Error(opened ? `Loki: closed (${ev.code}${ev.reason ? ` ${ev.reason}` : ""})` : `Loki: cannot connect to ${new URL(o.url).host}`));
|
|
962
|
+
};
|
|
963
|
+
}),
|
|
964
|
+
{ signal: h.signal, status: h.status, log: h.log }
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// src/sources.ts
|
|
969
|
+
var EMIT_GAP_MS = 1e3;
|
|
970
|
+
function expand(p, env = process.env, home = homedir()) {
|
|
971
|
+
const v = p.trim().replace(/\$(?:\{(\w+)\}|(\w+))/g, (whole, a, b) => env[a ?? b ?? ""] ?? whole);
|
|
972
|
+
if (v === "~") return home;
|
|
973
|
+
return /^~[\\/]/.test(v) ? join(home, v.slice(2)) : v;
|
|
974
|
+
}
|
|
975
|
+
function watchWith(kind, run, gapMs = EMIT_GAP_MS) {
|
|
976
|
+
return (ctx, emit) => {
|
|
977
|
+
const ac = new AbortController();
|
|
978
|
+
const signal = AbortSignal.any([ctx.signal, ac.signal]);
|
|
979
|
+
const buf = new LogBuffer(kind);
|
|
980
|
+
let status = { state: "following" };
|
|
981
|
+
const out = throttle(() => emit(buf.snapshot(status)), gapMs);
|
|
982
|
+
const h = {
|
|
983
|
+
signal,
|
|
984
|
+
add: (e) => {
|
|
985
|
+
buf.add(e);
|
|
986
|
+
out.schedule();
|
|
987
|
+
},
|
|
988
|
+
status: (s) => {
|
|
989
|
+
if (s.state === status.state && s.message === status.message) return;
|
|
990
|
+
status = s;
|
|
991
|
+
out.schedule();
|
|
992
|
+
},
|
|
993
|
+
log: (m) => ctx.log(`logs/${kind}: ${m}`)
|
|
994
|
+
};
|
|
995
|
+
const started = run(ctx.options, h, ctx);
|
|
996
|
+
if (started instanceof Promise) {
|
|
997
|
+
started.catch((err) => h.status({ state: "error", message: err instanceof Error ? err.message : String(err) }));
|
|
998
|
+
out.schedule();
|
|
999
|
+
} else {
|
|
1000
|
+
status = started;
|
|
1001
|
+
emit(buf.snapshot(status));
|
|
1002
|
+
}
|
|
1003
|
+
return () => {
|
|
1004
|
+
ac.abort();
|
|
1005
|
+
out.cancel();
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
var unitChoices = (d) => [...new Set([...d.lines, ...d.alerts].map((l) => l.unit))].sort().map((value) => ({ value }));
|
|
1010
|
+
var choices = { units: unitChoices };
|
|
1011
|
+
var OFF_PLATFORM = (what) => ({ state: "off", message: `${what}: not on this system` });
|
|
1012
|
+
var levelLabels = {
|
|
1013
|
+
error: L("Errors", "Errores", "Fehler", "\u9519\u8BEF", "\u932F\u8AA4"),
|
|
1014
|
+
warning: L("Warnings and worse", "Avisos y peor", "Warnungen und schlimmer", "\u8B66\u544A\u53CA\u4EE5\u4E0A", "\u8B66\u544A\u53CA\u4EE5\u4E0A"),
|
|
1015
|
+
notice: L("Notices and worse", "Notas y peor", "Hinweise und schlimmer", "\u901A\u77E5\u53CA\u4EE5\u4E0A", "\u901A\u77E5\u53CA\u4EE5\u4E0A"),
|
|
1016
|
+
info: L("Information and worse", "Informaci\xF3n y peor", "Informationen und schlimmer", "\u4FE1\u606F\u53CA\u4EE5\u4E0A", "\u8CC7\u8A0A\u53CA\u4EE5\u4E0A"),
|
|
1017
|
+
debug: L("Everything (debug too)", "Todo (tambi\xE9n depuraci\xF3n)", "Alles (auch Debug)", "\u5168\u90E8\uFF08\u5305\u62EC\u8C03\u8BD5\uFF09", "\u5168\u90E8\uFF08\u5305\u62EC\u9664\u932F\uFF09")
|
|
1018
|
+
};
|
|
1019
|
+
var binField = (program) => t.string({
|
|
1020
|
+
default: "",
|
|
1021
|
+
risk: "exec",
|
|
1022
|
+
advanced: true,
|
|
1023
|
+
placeholder: program,
|
|
1024
|
+
label: L("Program", "Programa", "Programm", "\u7A0B\u5E8F", "\u7A0B\u5F0F"),
|
|
1025
|
+
help: L(
|
|
1026
|
+
`The ${program} to run, by its full path. Empty: ${program} from the PATH.`,
|
|
1027
|
+
`El ${program} que ejecutar, con su ruta completa. Vac\xEDo: el ${program} del PATH.`,
|
|
1028
|
+
`Das auszuf\xFChrende ${program} mit vollst\xE4ndigem Pfad. Leer: ${program} aus dem PATH.`,
|
|
1029
|
+
`\u8981\u8FD0\u884C\u7684 ${program} \u7684\u5B8C\u6574\u8DEF\u5F84\u3002\u7559\u7A7A\uFF1A\u4F7F\u7528 PATH \u4E2D\u7684 ${program}\u3002`,
|
|
1030
|
+
`\u8981\u57F7\u884C\u7684 ${program} \u7684\u5B8C\u6574\u8DEF\u5F91\u3002\u7559\u7A7A\uFF1A\u4F7F\u7528 PATH \u4E2D\u7684 ${program}\u3002`
|
|
1031
|
+
)
|
|
1032
|
+
});
|
|
1033
|
+
var journal = defineSource({
|
|
1034
|
+
id: "journal",
|
|
1035
|
+
name: L("systemd journal", "Diario de systemd", "systemd-Journal", "systemd \u65E5\u5FD7", "systemd \u65E5\u8A8C"),
|
|
1036
|
+
description: L(
|
|
1037
|
+
"Follows the journal with journalctl, as it is written (Linux). Without the systemd-journal or adm group you see only your own user\u2019s messages.",
|
|
1038
|
+
"Sigue el diario con journalctl, seg\xFAn se escribe (Linux). Sin el grupo systemd-journal o adm solo ves los mensajes de tu usuario.",
|
|
1039
|
+
"Folgt dem Journal mit journalctl, w\xE4hrend es geschrieben wird (Linux). Ohne die Gruppe systemd-journal oder adm siehst du nur die Meldungen deines Benutzers.",
|
|
1040
|
+
"\u7528 journalctl \u5B9E\u65F6\u8DDF\u8E2A\u65E5\u5FD7\uFF08Linux\uFF09\u3002\u4E0D\u5728 systemd-journal \u6216 adm \u7EC4\u4E2D\u65F6\uFF0C\u53EA\u80FD\u770B\u5230\u4F60\u81EA\u5DF1\u7528\u6237\u7684\u6D88\u606F\u3002",
|
|
1041
|
+
"\u7528 journalctl \u5373\u6642\u8FFD\u8E64\u65E5\u8A8C\uFF08Linux\uFF09\u3002\u4E0D\u5728 systemd-journal \u6216 adm \u7FA4\u7D44\u4E2D\u6642\uFF0C\u53EA\u80FD\u770B\u5230\u4F60\u81EA\u5DF1\u4F7F\u7528\u8005\u7684\u8A0A\u606F\u3002"
|
|
1042
|
+
),
|
|
1043
|
+
options: t.object({
|
|
1044
|
+
units: t.filter({
|
|
1045
|
+
label: L("Units", "Unidades", "Units", "\u5355\u5143", "\u55AE\u5143"),
|
|
1046
|
+
choices: { source: "logs/journal", list: "units" }
|
|
1047
|
+
}),
|
|
1048
|
+
priority: t.enum(["error", "warning", "notice", "info", "debug"], {
|
|
1049
|
+
default: "info",
|
|
1050
|
+
label: L("Read from", "Leer desde", "Lesen ab", "\u8BFB\u53D6\u7EA7\u522B", "\u8B80\u53D6\u5C64\u7D1A"),
|
|
1051
|
+
labels: levelLabels,
|
|
1052
|
+
help: L(
|
|
1053
|
+
"The least serious messages journalctl reads. Each widget can show fewer.",
|
|
1054
|
+
"Los mensajes menos graves que lee journalctl. Cada widget puede mostrar menos.",
|
|
1055
|
+
"Die am wenigsten ernsten Meldungen, die journalctl liest. Jedes Widget kann weniger zeigen.",
|
|
1056
|
+
"journalctl \u8BFB\u53D6\u7684\u6700\u4F4E\u7EA7\u522B\u6D88\u606F\u3002\u6BCF\u4E2A\u5C0F\u7EC4\u4EF6\u53EF\u4EE5\u663E\u793A\u66F4\u5C11\u3002",
|
|
1057
|
+
"journalctl \u8B80\u53D6\u7684\u6700\u4F4E\u5C64\u7D1A\u8A0A\u606F\u3002\u6BCF\u500B\u5C0F\u5DE5\u5177\u53EF\u4EE5\u986F\u793A\u66F4\u5C11\u3002"
|
|
1058
|
+
)
|
|
1059
|
+
}),
|
|
1060
|
+
onlyUser: t.boolean({
|
|
1061
|
+
default: false,
|
|
1062
|
+
label: L("Only my user\u2019s journal", "Solo el diario de mi usuario", "Nur das Journal meines Benutzers", "\u4EC5\u6211\u7684\u7528\u6237\u65E5\u5FD7", "\u50C5\u6211\u7684\u4F7F\u7528\u8005\u65E5\u8A8C"),
|
|
1063
|
+
help: L("journalctl --user: your user services, not the system\u2019s.", "journalctl --user: tus servicios de usuario, no los del sistema.", "journalctl --user: deine Benutzerdienste, nicht die des Systems.", "journalctl --user\uFF1A\u4F60\u7684\u7528\u6237\u670D\u52A1\uFF0C\u800C\u4E0D\u662F\u7CFB\u7EDF\u7684\u3002", "journalctl --user\uFF1A\u4F60\u7684\u4F7F\u7528\u8005\u670D\u52D9\uFF0C\u800C\u4E0D\u662F\u7CFB\u7D71\u7684\u3002")
|
|
1064
|
+
}),
|
|
1065
|
+
bin: binField("journalctl")
|
|
1066
|
+
}),
|
|
1067
|
+
watch: watchWith("journal", (o, h) => process.platform === "linux" ? followJournal(o, h) : OFF_PLATFORM("journald")),
|
|
1068
|
+
demo: ({ now }) => demoData("journal", now),
|
|
1069
|
+
choices
|
|
1070
|
+
});
|
|
1071
|
+
var file = defineSource({
|
|
1072
|
+
id: "file",
|
|
1073
|
+
name: L("Log files", "Archivos de log", "Logdateien", "\u65E5\u5FD7\u6587\u4EF6", "\u65E5\u8A8C\u6A94"),
|
|
1074
|
+
description: L(
|
|
1075
|
+
"Follows the end of log files, like tail -F: it survives rotation and truncation and waits for a file that isn\u2019t there yet.",
|
|
1076
|
+
"Sigue el final de archivos de log, como tail -F: sobrevive a la rotaci\xF3n y al vaciado y espera a un archivo que a\xFAn no existe.",
|
|
1077
|
+
"Folgt dem Ende von Logdateien wie tail -F: \xFCbersteht Rotation und K\xFCrzen und wartet auf eine Datei, die es noch nicht gibt.",
|
|
1078
|
+
"\u50CF tail -F \u4E00\u6837\u8DDF\u8E2A\u65E5\u5FD7\u6587\u4EF6\u7684\u672B\u5C3E\uFF1A\u80FD\u5E94\u5BF9\u8F6E\u8F6C\u548C\u6E05\u7A7A\uFF0C\u5E76\u7B49\u5F85\u5C1A\u4E0D\u5B58\u5728\u7684\u6587\u4EF6\u3002",
|
|
1079
|
+
"\u50CF tail -F \u4E00\u6A23\u8FFD\u8E64\u65E5\u8A8C\u6A94\u7684\u7D50\u5C3E\uFF1A\u80FD\u61C9\u4ED8\u8F2A\u66FF\u8207\u6E05\u7A7A\uFF0C\u4E26\u7B49\u5F85\u5C1A\u4E0D\u5B58\u5728\u7684\u6A94\u6848\u3002"
|
|
1080
|
+
),
|
|
1081
|
+
options: t.object({
|
|
1082
|
+
paths: t.list(t.string({ default: "", format: "path", risk: "path", placeholder: "/var/log/nginx/error.log" }), {
|
|
1083
|
+
risk: "path",
|
|
1084
|
+
max: 20,
|
|
1085
|
+
label: L("Files", "Archivos", "Dateien", "\u6587\u4EF6", "\u6A94\u6848"),
|
|
1086
|
+
help: L(
|
|
1087
|
+
"One or more log files, by their full path. Empty: none is read.",
|
|
1088
|
+
"Uno o m\xE1s archivos de log, con su ruta completa. Vac\xEDo: no se lee ninguno.",
|
|
1089
|
+
"Eine oder mehrere Logdateien mit vollst\xE4ndigem Pfad. Leer: keine wird gelesen.",
|
|
1090
|
+
"\u4E00\u4E2A\u6216\u591A\u4E2A\u65E5\u5FD7\u6587\u4EF6\u7684\u5B8C\u6574\u8DEF\u5F84\u3002\u7559\u7A7A\uFF1A\u4E0D\u8BFB\u53D6\u4EFB\u4F55\u6587\u4EF6\u3002",
|
|
1091
|
+
"\u4E00\u500B\u6216\u591A\u500B\u65E5\u8A8C\u6A94\u7684\u5B8C\u6574\u8DEF\u5F91\u3002\u7559\u7A7A\uFF1A\u4E0D\u8B80\u53D6\u4EFB\u4F55\u6A94\u6848\u3002"
|
|
1092
|
+
)
|
|
1093
|
+
})
|
|
1094
|
+
}),
|
|
1095
|
+
watch: watchWith("file", (o, h) => {
|
|
1096
|
+
const paths = [...new Set(o.paths.map((p) => expand(p)).filter(Boolean))];
|
|
1097
|
+
return paths.length ? followFiles(paths, h) : { state: "off", message: "no log file set" };
|
|
1098
|
+
}),
|
|
1099
|
+
demo: ({ now }) => demoData("file", now),
|
|
1100
|
+
choices
|
|
1101
|
+
});
|
|
1102
|
+
var docker = defineSource({
|
|
1103
|
+
id: "docker",
|
|
1104
|
+
name: L("Docker containers", "Contenedores Docker", "Docker-Container", "Docker \u5BB9\u5668", "Docker \u5BB9\u5668"),
|
|
1105
|
+
description: L(
|
|
1106
|
+
"Follows the logs of the containers you choose, through Docker\u2019s socket. Access to that socket is root access to the machine: give it only on a machine you trust.",
|
|
1107
|
+
"Sigue los logs de los contenedores que elijas, por el socket de Docker. Acceder a ese socket es acceder como root a la m\xE1quina: d\xE1selo solo en una m\xE1quina de confianza.",
|
|
1108
|
+
"Folgt den Logs der gew\xE4hlten Container \xFCber Dockers Socket. Zugriff auf diesen Socket ist Root-Zugriff auf den Rechner: nur auf einem Rechner geben, dem du vertraust.",
|
|
1109
|
+
"\u901A\u8FC7 Docker \u7684\u5957\u63A5\u5B57\u8DDF\u8E2A\u4F60\u9009\u62E9\u7684\u5BB9\u5668\u7684\u65E5\u5FD7\u3002\u80FD\u8BBF\u95EE\u8FD9\u4E2A\u5957\u63A5\u5B57\u5C31\u7B49\u4E8E\u62E5\u6709\u8FD9\u53F0\u673A\u5668\u7684 root \u6743\u9650\uFF1A\u53EA\u5728\u4F60\u4FE1\u4EFB\u7684\u673A\u5668\u4E0A\u5F00\u542F\u3002",
|
|
1110
|
+
"\u900F\u904E Docker \u7684 socket \u8FFD\u8E64\u4F60\u9078\u64C7\u7684\u5BB9\u5668\u65E5\u8A8C\u3002\u80FD\u5B58\u53D6\u9019\u500B socket \u5C31\u7B49\u65BC\u64C1\u6709\u9019\u53F0\u6A5F\u5668\u7684 root \u6B0A\u9650\uFF1A\u53EA\u5728\u4F60\u4FE1\u4EFB\u7684\u6A5F\u5668\u4E0A\u958B\u555F\u3002"
|
|
1111
|
+
),
|
|
1112
|
+
options: t.object({
|
|
1113
|
+
containers: t.filter({
|
|
1114
|
+
label: L("Containers", "Contenedores", "Container", "\u5BB9\u5668", "\u5BB9\u5668"),
|
|
1115
|
+
help: L(
|
|
1116
|
+
"Which running containers to follow, by name or Compose service: web, db-*, !*-test. Empty: none, Docker is not read; * for all.",
|
|
1117
|
+
"Qu\xE9 contenedores en marcha seguir, por nombre o servicio de Compose: web, db-*, !*-test. Vac\xEDo: ninguno, no se lee Docker; * para todos.",
|
|
1118
|
+
"Welche laufenden Container verfolgt werden, nach Name oder Compose-Dienst: web, db-*, !*-test. Leer: keiner, Docker wird nicht gelesen; * f\xFCr alle.",
|
|
1119
|
+
"\u8981\u8DDF\u8E2A\u54EA\u4E9B\u8FD0\u884C\u4E2D\u7684\u5BB9\u5668\uFF08\u6309\u540D\u79F0\u6216 Compose \u670D\u52A1\uFF09\uFF1Aweb, db-*, !*-test\u3002\u7559\u7A7A\uFF1A\u4E0D\u8BFB\u53D6 Docker\uFF1B* \u8868\u793A\u5168\u90E8\u3002",
|
|
1120
|
+
"\u8981\u8FFD\u8E64\u54EA\u4E9B\u57F7\u884C\u4E2D\u7684\u5BB9\u5668\uFF08\u4F9D\u540D\u7A31\u6216 Compose \u670D\u52D9\uFF09\uFF1Aweb, db-*, !*-test\u3002\u7559\u7A7A\uFF1A\u4E0D\u8B80\u53D6 Docker\uFF1B* \u8868\u793A\u5168\u90E8\u3002"
|
|
1121
|
+
),
|
|
1122
|
+
choices: { source: "logs/docker", list: "units" }
|
|
1123
|
+
}),
|
|
1124
|
+
socket: t.string({
|
|
1125
|
+
default: "",
|
|
1126
|
+
format: "path",
|
|
1127
|
+
risk: "path",
|
|
1128
|
+
advanced: true,
|
|
1129
|
+
placeholder: "/var/run/docker.sock",
|
|
1130
|
+
label: L("Docker socket", "Socket de Docker", "Docker-Socket", "Docker \u5957\u63A5\u5B57", "Docker socket"),
|
|
1131
|
+
help: L(
|
|
1132
|
+
"Empty: DOCKER_HOST, else rootless Docker\u2019s ($XDG_RUNTIME_DIR/docker.sock), Docker Desktop\u2019s, or /var/run/docker.sock.",
|
|
1133
|
+
"Vac\xEDo: DOCKER_HOST, o si no el de Docker sin root ($XDG_RUNTIME_DIR/docker.sock), el de Docker Desktop o /var/run/docker.sock.",
|
|
1134
|
+
"Leer: DOCKER_HOST, sonst der von rootlosem Docker ($XDG_RUNTIME_DIR/docker.sock), der von Docker Desktop oder /var/run/docker.sock.",
|
|
1135
|
+
"\u7559\u7A7A\uFF1A\u4F7F\u7528 DOCKER_HOST\uFF0C\u5426\u5219\u4F9D\u6B21\u4E3A\u65E0 root Docker \u7684\uFF08$XDG_RUNTIME_DIR/docker.sock\uFF09\u3001Docker Desktop \u7684\u6216 /var/run/docker.sock\u3002",
|
|
1136
|
+
"\u7559\u7A7A\uFF1A\u4F7F\u7528 DOCKER_HOST\uFF0C\u5426\u5247\u4F9D\u5E8F\u70BA\u7121 root Docker \u7684\uFF08$XDG_RUNTIME_DIR/docker.sock\uFF09\u3001Docker Desktop \u7684\u6216 /var/run/docker.sock\u3002"
|
|
1137
|
+
)
|
|
1138
|
+
})
|
|
1139
|
+
}),
|
|
1140
|
+
watch: watchWith("docker", (o, h) => {
|
|
1141
|
+
if (!o.containers.length) return { state: "off", message: "no container chosen" };
|
|
1142
|
+
return followDocker({ containers: o.containers, socket: expand(o.socket) || defaultDockerSocket() }, h);
|
|
1143
|
+
}),
|
|
1144
|
+
demo: ({ now }) => demoData("docker", now),
|
|
1145
|
+
choices
|
|
1146
|
+
});
|
|
1147
|
+
var macos = defineSource({
|
|
1148
|
+
id: "macos",
|
|
1149
|
+
name: L("macOS unified log", "Registro unificado de macOS", "Einheitliches macOS-Protokoll", "macOS \u7EDF\u4E00\u65E5\u5FD7", "macOS \u7D71\u4E00\u65E5\u8A8C"),
|
|
1150
|
+
description: L(
|
|
1151
|
+
"Follows macOS\u2019s log with log stream. By default only errors and faults: the whole log is thousands of lines a second.",
|
|
1152
|
+
"Sigue el registro de macOS con log stream. Por omisi\xF3n solo errores y fallos: el registro entero son miles de l\xEDneas por segundo.",
|
|
1153
|
+
"Folgt dem macOS-Protokoll mit log stream. Standardm\xE4\xDFig nur Fehler: das ganze Protokoll sind Tausende Zeilen pro Sekunde.",
|
|
1154
|
+
"\u7528 log stream \u8DDF\u8E2A macOS \u65E5\u5FD7\u3002\u9ED8\u8BA4\u53EA\u770B\u9519\u8BEF\u548C\u6545\u969C\uFF1A\u5B8C\u6574\u65E5\u5FD7\u6BCF\u79D2\u6709\u6210\u5343\u4E0A\u4E07\u884C\u3002",
|
|
1155
|
+
"\u7528 log stream \u8FFD\u8E64 macOS \u65E5\u8A8C\u3002\u9810\u8A2D\u53EA\u770B\u932F\u8AA4\u8207\u6545\u969C\uFF1A\u5B8C\u6574\u65E5\u8A8C\u6BCF\u79D2\u6709\u6210\u5343\u4E0A\u842C\u884C\u3002"
|
|
1156
|
+
),
|
|
1157
|
+
options: t.object({
|
|
1158
|
+
predicate: t.string({
|
|
1159
|
+
default: "messageType == error OR messageType == fault",
|
|
1160
|
+
label: L("Predicate", "Predicado", "Pr\xE4dikat", "\u8C13\u8BCD", "\u8FF0\u8A5E"),
|
|
1161
|
+
help: L(
|
|
1162
|
+
'Which messages, as log stream --predicate takes it: process == "nginx", subsystem == "com.example.app". Empty: all of them.',
|
|
1163
|
+
'Qu\xE9 mensajes, como lo toma log stream --predicate: process == "nginx", subsystem == "com.example.app". Vac\xEDo: todos.',
|
|
1164
|
+
'Welche Meldungen, wie log stream --predicate es nimmt: process == "nginx", subsystem == "com.example.app". Leer: alle.',
|
|
1165
|
+
'\u8981\u54EA\u4E9B\u6D88\u606F\uFF0C\u6309 log stream --predicate \u7684\u5199\u6CD5\uFF1Aprocess == "nginx"\u3001subsystem == "com.example.app"\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u3002',
|
|
1166
|
+
'\u8981\u54EA\u4E9B\u8A0A\u606F\uFF0C\u4F9D log stream --predicate \u7684\u5BEB\u6CD5\uFF1Aprocess == "nginx"\u3001subsystem == "com.example.app"\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u3002'
|
|
1167
|
+
)
|
|
1168
|
+
}),
|
|
1169
|
+
level: t.enum(["default", "info", "debug"], {
|
|
1170
|
+
default: "default",
|
|
1171
|
+
label: L("Level", "Nivel", "Stufe", "\u7EA7\u522B", "\u5C64\u7D1A"),
|
|
1172
|
+
labels: {
|
|
1173
|
+
default: L("Default", "Normal", "Standard", "\u9ED8\u8BA4", "\u9810\u8A2D"),
|
|
1174
|
+
info: L("Info too", "Tambi\xE9n info", "Auch Info", "\u5305\u62EC\u4FE1\u606F", "\u5305\u62EC\u8CC7\u8A0A"),
|
|
1175
|
+
debug: L("Debug too", "Tambi\xE9n depuraci\xF3n", "Auch Debug", "\u5305\u62EC\u8C03\u8BD5", "\u5305\u62EC\u9664\u932F")
|
|
1176
|
+
}
|
|
1177
|
+
}),
|
|
1178
|
+
bin: binField("/usr/bin/log")
|
|
1179
|
+
}),
|
|
1180
|
+
watch: watchWith("macos", (o, h) => process.platform === "darwin" ? followMacos(o, h) : OFF_PLATFORM("macOS log")),
|
|
1181
|
+
demo: ({ now }) => demoData("macos", now),
|
|
1182
|
+
choices
|
|
1183
|
+
});
|
|
1184
|
+
var windows = defineSource({
|
|
1185
|
+
id: "windows",
|
|
1186
|
+
name: L("Windows Event Log", "Visor de eventos de Windows", "Windows-Ereignisprotokoll", "Windows \u4E8B\u4EF6\u65E5\u5FD7", "Windows \u4E8B\u4EF6\u8A18\u9304"),
|
|
1187
|
+
description: L(
|
|
1188
|
+
"New events of the Windows logs you choose, read with PowerShell\u2019s Get-WinEvent every 15 seconds.",
|
|
1189
|
+
"Los eventos nuevos de los registros de Windows que elijas, le\xEDdos con Get-WinEvent de PowerShell cada 15 segundos.",
|
|
1190
|
+
"Neue Ereignisse der gew\xE4hlten Windows-Protokolle, alle 15 Sekunden mit Get-WinEvent aus PowerShell gelesen.",
|
|
1191
|
+
"\u4F60\u9009\u62E9\u7684 Windows \u65E5\u5FD7\u4E2D\u7684\u65B0\u4E8B\u4EF6\uFF0C\u6BCF 15 \u79D2\u7528 PowerShell \u7684 Get-WinEvent \u8BFB\u53D6\u4E00\u6B21\u3002",
|
|
1192
|
+
"\u4F60\u9078\u64C7\u7684 Windows \u8A18\u9304\u4E2D\u7684\u65B0\u4E8B\u4EF6\uFF0C\u6BCF 15 \u79D2\u7528 PowerShell \u7684 Get-WinEvent \u8B80\u53D6\u4E00\u6B21\u3002"
|
|
1193
|
+
),
|
|
1194
|
+
options: t.object({
|
|
1195
|
+
logs: t.list(t.string({ default: "" }), {
|
|
1196
|
+
default: ["System", "Application"],
|
|
1197
|
+
max: 10,
|
|
1198
|
+
label: L("Logs", "Registros", "Protokolle", "\u65E5\u5FD7", "\u8A18\u9304"),
|
|
1199
|
+
help: L("Event log names: System, Application, Security (needs an administrator)\u2026", "Nombres de registro: System, Application, Security (requiere administrador)\u2026", "Namen der Protokolle: System, Application, Security (braucht Administrator)\u2026", "\u4E8B\u4EF6\u65E5\u5FD7\u540D\u79F0\uFF1ASystem\u3001Application\u3001Security\uFF08\u9700\u8981\u7BA1\u7406\u5458\uFF09\u2026", "\u4E8B\u4EF6\u8A18\u9304\u540D\u7A31\uFF1ASystem\u3001Application\u3001Security\uFF08\u9700\u8981\u7CFB\u7D71\u7BA1\u7406\u54E1\uFF09\u2026")
|
|
1200
|
+
}),
|
|
1201
|
+
priority: t.enum(["error", "warning", "info"], {
|
|
1202
|
+
default: "warning",
|
|
1203
|
+
label: L("Read from", "Leer desde", "Lesen ab", "\u8BFB\u53D6\u7EA7\u522B", "\u8B80\u53D6\u5C64\u7D1A"),
|
|
1204
|
+
labels: { error: levelLabels.error, warning: levelLabels.warning, info: levelLabels.info }
|
|
1205
|
+
}),
|
|
1206
|
+
bin: binField("powershell.exe")
|
|
1207
|
+
}),
|
|
1208
|
+
watch: watchWith("windows", (o, h) => process.platform === "win32" ? followWindows(o, h) : OFF_PLATFORM("Windows events")),
|
|
1209
|
+
demo: ({ now }) => demoData("windows", now),
|
|
1210
|
+
choices
|
|
1211
|
+
});
|
|
1212
|
+
var kubernetes = defineSource({
|
|
1213
|
+
id: "kubernetes",
|
|
1214
|
+
name: L("Kubernetes pods", "Pods de Kubernetes", "Kubernetes-Pods", "Kubernetes Pod", "Kubernetes Pod"),
|
|
1215
|
+
description: L(
|
|
1216
|
+
"Follows pods\u2019 logs with kubectl logs -f, with your kubeconfig and its permissions.",
|
|
1217
|
+
"Sigue los logs de pods con kubectl logs -f, con tu kubeconfig y sus permisos.",
|
|
1218
|
+
"Folgt den Logs von Pods mit kubectl logs -f, mit deiner kubeconfig und ihren Rechten.",
|
|
1219
|
+
"\u7528 kubectl logs -f \u8DDF\u8E2A Pod \u65E5\u5FD7\uFF0C\u4F7F\u7528\u4F60\u7684 kubeconfig \u53CA\u5176\u6743\u9650\u3002",
|
|
1220
|
+
"\u7528 kubectl logs -f \u8FFD\u8E64 Pod \u65E5\u8A8C\uFF0C\u4F7F\u7528\u4F60\u7684 kubeconfig \u53CA\u5176\u6B0A\u9650\u3002"
|
|
1221
|
+
),
|
|
1222
|
+
options: t.object({
|
|
1223
|
+
selector: t.string({
|
|
1224
|
+
default: "",
|
|
1225
|
+
placeholder: "app=shop",
|
|
1226
|
+
label: L("Pods", "Pods", "Pods", "Pod", "Pod"),
|
|
1227
|
+
help: L("A label selector (app=shop) or a resource (deployment/shop). Empty: kubectl is not run.", "Un selector de etiquetas (app=shop) o un recurso (deployment/shop). Vac\xEDo: no se ejecuta kubectl.", "Ein Label-Selektor (app=shop) oder eine Ressource (deployment/shop). Leer: kubectl wird nicht ausgef\xFChrt.", "\u6807\u7B7E\u9009\u62E9\u5668\uFF08app=shop\uFF09\u6216\u8D44\u6E90\uFF08deployment/shop\uFF09\u3002\u7559\u7A7A\uFF1A\u4E0D\u8FD0\u884C kubectl\u3002", "\u6A19\u7C64\u9078\u64C7\u5668\uFF08app=shop\uFF09\u6216\u8CC7\u6E90\uFF08deployment/shop\uFF09\u3002\u7559\u7A7A\uFF1A\u4E0D\u57F7\u884C kubectl\u3002")
|
|
1228
|
+
}),
|
|
1229
|
+
namespace: t.string({ default: "", label: L("Namespace", "Espacio de nombres", "Namespace", "\u547D\u540D\u7A7A\u95F4", "\u547D\u540D\u7A7A\u9593") }),
|
|
1230
|
+
context: t.string({ default: "", risk: "network", advanced: true, label: L("kubeconfig context", "Contexto de kubeconfig", "kubeconfig-Kontext", "kubeconfig \u4E0A\u4E0B\u6587", "kubeconfig \u5167\u5BB9"), help: L("Empty: the current one.", "Vac\xEDo: el actual.", "Leer: der aktuelle.", "\u7559\u7A7A\uFF1A\u5F53\u524D\u4E0A\u4E0B\u6587\u3002", "\u7559\u7A7A\uFF1A\u76EE\u524D\u7684\u5167\u5BB9\u3002") }),
|
|
1231
|
+
bin: binField("kubectl")
|
|
1232
|
+
}),
|
|
1233
|
+
watch: watchWith("kubernetes", (o, h) => o.selector.trim() ? followKube(o, h) : { state: "off", message: "no pods chosen" }),
|
|
1234
|
+
demo: ({ now }) => demoData("kubernetes", now),
|
|
1235
|
+
choices
|
|
1236
|
+
});
|
|
1237
|
+
var loki = defineSource({
|
|
1238
|
+
id: "loki",
|
|
1239
|
+
name: L("Grafana Loki", "Grafana Loki", "Grafana Loki", "Grafana Loki", "Grafana Loki"),
|
|
1240
|
+
description: L(
|
|
1241
|
+
"Live lines of a LogQL query, through Loki\u2019s tail API.",
|
|
1242
|
+
"Las l\xEDneas en vivo de una consulta LogQL, por la API de tail de Loki.",
|
|
1243
|
+
"Live-Zeilen einer LogQL-Abfrage \xFCber Lokis Tail-API.",
|
|
1244
|
+
"\u901A\u8FC7 Loki \u7684 tail API \u83B7\u53D6 LogQL \u67E5\u8BE2\u7684\u5B9E\u65F6\u65E5\u5FD7\u884C\u3002",
|
|
1245
|
+
"\u900F\u904E Loki \u7684 tail API \u53D6\u5F97 LogQL \u67E5\u8A62\u7684\u5373\u6642\u65E5\u8A8C\u884C\u3002"
|
|
1246
|
+
),
|
|
1247
|
+
options: t.object({
|
|
1248
|
+
url: t.string({ default: "", format: "url", risk: "network", placeholder: "http://loki.example.lan:3100", label: L("Loki address", "Direcci\xF3n de Loki", "Loki-Adresse", "Loki \u5730\u5740", "Loki \u4F4D\u5740"), help: L("Empty: Loki is not contacted.", "Vac\xEDo: no se contacta con Loki.", "Leer: Loki wird nicht kontaktiert.", "\u7559\u7A7A\uFF1A\u4E0D\u8FDE\u63A5 Loki\u3002", "\u7559\u7A7A\uFF1A\u4E0D\u9023\u7DDA Loki\u3002") }),
|
|
1249
|
+
query: t.string({ default: "", placeholder: '{job="nginx"} |= "error"', label: L("Query (LogQL)", "Consulta (LogQL)", "Abfrage (LogQL)", "\u67E5\u8BE2\uFF08LogQL\uFF09", "\u67E5\u8A62\uFF08LogQL\uFF09") }),
|
|
1250
|
+
token: t.string({ default: "", secret: true, advanced: true, label: L("Token", "Token", "Token", "\u4EE4\u724C", "\u6B0A\u6756"), help: L("Sent as Authorization: Bearer. Or put user:password in the address.", "Se env\xEDa como Authorization: Bearer. O pon usuario:contrase\xF1a en la direcci\xF3n.", "Wird als Authorization: Bearer gesendet. Oder Benutzer:Passwort in die Adresse.", "\u4F5C\u4E3A Authorization: Bearer \u53D1\u9001\u3002\u4E5F\u53EF\u4EE5\u5728\u5730\u5740\u91CC\u5199 \u7528\u6237:\u5BC6\u7801\u3002", "\u4EE5 Authorization: Bearer \u50B3\u9001\u3002\u4E5F\u53EF\u4EE5\u5728\u4F4D\u5740\u88E1\u5BEB \u4F7F\u7528\u8005:\u5BC6\u78BC\u3002") }),
|
|
1251
|
+
orgId: t.string({ default: "", advanced: true, label: L("Tenant (X-Scope-OrgID)", "Inquilino (X-Scope-OrgID)", "Mandant (X-Scope-OrgID)", "\u79DF\u6237\uFF08X-Scope-OrgID\uFF09", "\u79DF\u6236\uFF08X-Scope-OrgID\uFF09") })
|
|
1252
|
+
}),
|
|
1253
|
+
watch: watchWith("loki", (o, h) => o.url.trim() && o.query.trim() ? followLoki(o, h) : { state: "off", message: "no Loki address or query" }),
|
|
1254
|
+
demo: ({ now }) => demoData("loki", now),
|
|
1255
|
+
choices
|
|
1256
|
+
});
|
|
1257
|
+
var SOURCES = [journal, file, docker, macos, windows, kubernetes, loki];
|
|
1258
|
+
|
|
1259
|
+
// src/widgets.ts
|
|
1260
|
+
import { defineWidget, drawEmpty, drawMore, listLayout, listOptions, t as t2 } from "@kiosko/sdk";
|
|
1261
|
+
|
|
1262
|
+
// src/view.ts
|
|
1263
|
+
import { filterPatterns, matchFilter as matchFilter2 } from "@kiosko/sdk";
|
|
1264
|
+
var SOURCE_IDS = ["logs/journal", "logs/file", "logs/docker", "logs/macos", "logs/windows", "logs/kubernetes", "logs/loki"];
|
|
1265
|
+
var isData = (v) => !!v && typeof v === "object" && Array.isArray(v.lines) && Array.isArray(v.alerts);
|
|
1266
|
+
function collect(sources, which) {
|
|
1267
|
+
const out = [];
|
|
1268
|
+
for (const id of SOURCE_IDS) {
|
|
1269
|
+
const d = sources[id];
|
|
1270
|
+
if (isData(d)) out.push(...d[which]);
|
|
1271
|
+
}
|
|
1272
|
+
return out.sort((a, b) => a.t - b.t);
|
|
1273
|
+
}
|
|
1274
|
+
function statuses(sources) {
|
|
1275
|
+
return SOURCE_IDS.flatMap((id) => {
|
|
1276
|
+
const d = sources[id];
|
|
1277
|
+
return isData(d) && d.status ? [{ id, status: d.status }] : [];
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
function messageTest(pattern) {
|
|
1281
|
+
const re = /^\/(.+)\/([a-z]*)$/.exec(pattern);
|
|
1282
|
+
if (re) {
|
|
1283
|
+
try {
|
|
1284
|
+
const flags = re[2].replace(/[gy]/g, "");
|
|
1285
|
+
const r = new RegExp(re[1], flags.includes("i") || /[A-Z]/.test(re[1]) ? flags : `${flags}i`);
|
|
1286
|
+
return (msg) => r.test(msg);
|
|
1287
|
+
} catch {
|
|
1288
|
+
return null;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
const glob = /[*?]/.test(pattern) ? pattern : `*${pattern}*`;
|
|
1292
|
+
return (msg) => matchFilter2(msg, [glob]);
|
|
1293
|
+
}
|
|
1294
|
+
var cache = /* @__PURE__ */ new Map();
|
|
1295
|
+
function matchMessage(msg, filter) {
|
|
1296
|
+
const list = filterPatterns(filter);
|
|
1297
|
+
if (!list.length) return true;
|
|
1298
|
+
const key = JSON.stringify(list);
|
|
1299
|
+
let fn = cache.get(key);
|
|
1300
|
+
if (!fn) {
|
|
1301
|
+
const inc = list.filter((p) => !p.startsWith("!")).map(messageTest).filter((f) => !!f);
|
|
1302
|
+
const exc = list.filter((p) => p.startsWith("!")).map((p) => messageTest(p.slice(1).trim())).filter((f) => !!f);
|
|
1303
|
+
fn = (m) => !exc.some((f) => f(m)) && (!inc.length || inc.some((f) => f(m)));
|
|
1304
|
+
if (cache.size > 200) cache.clear();
|
|
1305
|
+
cache.set(key, fn);
|
|
1306
|
+
}
|
|
1307
|
+
return fn(msg);
|
|
1308
|
+
}
|
|
1309
|
+
var unitNames = (l) => [`${l.kind}/${l.unit}`, l.unit];
|
|
1310
|
+
function select(lines, o) {
|
|
1311
|
+
const lowest = o.level ? rank(o.level) : Infinity;
|
|
1312
|
+
return lines.filter((l) => rank(l.level) <= lowest && matchFilter2(unitNames(l), o.units) && matchMessage(l.msg, o.messages));
|
|
1313
|
+
}
|
|
1314
|
+
function fold(lines) {
|
|
1315
|
+
const out = [];
|
|
1316
|
+
for (const l of lines) {
|
|
1317
|
+
const prev = out[out.length - 1];
|
|
1318
|
+
if (prev && prev.msg === l.msg && prev.unit === l.unit && prev.level === l.level && prev.kind === l.kind) {
|
|
1319
|
+
out[out.length - 1] = { ...prev, t: Math.max(prev.t, l.t), first: Math.min(prev.first, l.first), count: prev.count + l.count };
|
|
1320
|
+
} else out.push(l);
|
|
1321
|
+
}
|
|
1322
|
+
return out;
|
|
1323
|
+
}
|
|
1324
|
+
function perMinute(lines, now, historyMs, buckets) {
|
|
1325
|
+
const n = Math.max(1, Math.floor(buckets));
|
|
1326
|
+
const span = Math.max(6e4, historyMs);
|
|
1327
|
+
const start = now - span;
|
|
1328
|
+
const size = span / n;
|
|
1329
|
+
const out = new Array(n).fill(0);
|
|
1330
|
+
const put = (t3, c) => {
|
|
1331
|
+
if (t3 < start || t3 > now) return;
|
|
1332
|
+
out[Math.min(n - 1, Math.floor((t3 - start) / size))] += c;
|
|
1333
|
+
};
|
|
1334
|
+
for (const l of lines) {
|
|
1335
|
+
if (l.count <= 1 || l.t === l.first) put(l.t, l.count);
|
|
1336
|
+
else for (let i = 0; i < l.count; i++) put(l.first + (l.t - l.first) * i / (l.count - 1), 1);
|
|
1337
|
+
}
|
|
1338
|
+
const scale = 6e4 / size;
|
|
1339
|
+
return out.map((v) => v * scale);
|
|
1340
|
+
}
|
|
1341
|
+
function newest(lines, worst = "error") {
|
|
1342
|
+
for (let i = lines.length - 1; i >= 0; i--) if (rank(lines[i].level) <= rank(worst)) return lines[i];
|
|
1343
|
+
return null;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// src/widgets.ts
|
|
1347
|
+
var QUIET_MS = 10 * 6e4;
|
|
1348
|
+
var units = () => t2.filter({
|
|
1349
|
+
label: L("Units, containers, files", "Unidades, contenedores, archivos", "Units, Container, Dateien", "\u5355\u5143\u3001\u5BB9\u5668\u3001\u6587\u4EF6", "\u55AE\u5143\u3001\u5BB9\u5668\u3001\u6A94\u6848"),
|
|
1350
|
+
help: L(
|
|
1351
|
+
"Which logs to show, by name: nginx.service, web, app.log; by kind: journal/*, docker/*, file/*; and !cron to leave one out. Empty: all.",
|
|
1352
|
+
"Qu\xE9 logs mostrar, por nombre: nginx.service, web, app.log; por tipo: journal/*, docker/*, file/*; y !cron para quitar uno. Vac\xEDo: todos.",
|
|
1353
|
+
"Welche Logs gezeigt werden, nach Name: nginx.service, web, app.log; nach Art: journal/*, docker/*, file/*; und !cron, um eines wegzulassen. Leer: alle.",
|
|
1354
|
+
"\u6309\u540D\u79F0\u9009\u62E9\u8981\u663E\u793A\u7684\u65E5\u5FD7\uFF1Anginx.service\u3001web\u3001app.log\uFF1B\u6309\u7C7B\u578B\uFF1Ajournal/*\u3001docker/*\u3001file/*\uFF1B\u7528 !cron \u6392\u9664\u67D0\u4E2A\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u3002",
|
|
1355
|
+
"\u4F9D\u540D\u7A31\u9078\u64C7\u8981\u986F\u793A\u7684\u65E5\u8A8C\uFF1Anginx.service\u3001web\u3001app.log\uFF1B\u4F9D\u985E\u578B\uFF1Ajournal/*\u3001docker/*\u3001file/*\uFF1B\u7528 !cron \u6392\u9664\u67D0\u500B\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u3002"
|
|
1356
|
+
)
|
|
1357
|
+
});
|
|
1358
|
+
var messages = () => t2.filter({
|
|
1359
|
+
label: L("Messages", "Mensajes", "Meldungen", "\u6D88\u606F", "\u8A0A\u606F"),
|
|
1360
|
+
help: L(
|
|
1361
|
+
"Only lines with these words: timeout, refused; leave out with !healthcheck; a regular expression between slashes: /5\\d\\d/. Empty: all lines.",
|
|
1362
|
+
"Solo las l\xEDneas con estas palabras: timeout, refused; quita con !healthcheck; una expresi\xF3n regular entre barras: /5\\d\\d/. Vac\xEDo: todas.",
|
|
1363
|
+
"Nur Zeilen mit diesen W\xF6rtern: timeout, refused; weglassen mit !healthcheck; ein regul\xE4rer Ausdruck zwischen Schr\xE4gstrichen: /5\\d\\d/. Leer: alle Zeilen.",
|
|
1364
|
+
"\u53EA\u663E\u793A\u542B\u8FD9\u4E9B\u8BCD\u7684\u884C\uFF1Atimeout\u3001refused\uFF1B\u7528 !healthcheck \u6392\u9664\uFF1B\u659C\u6760\u4E4B\u95F4\u5199\u6B63\u5219\u8868\u8FBE\u5F0F\uFF1A/5\\d\\d/\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u3002",
|
|
1365
|
+
"\u53EA\u986F\u793A\u542B\u9019\u4E9B\u8A5E\u7684\u884C\uFF1Atimeout\u3001refused\uFF1B\u7528 !healthcheck \u6392\u9664\uFF1B\u659C\u7DDA\u4E4B\u9593\u5BEB\u6B63\u898F\u8868\u793A\u5F0F\uFF1A/5\\d\\d/\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u3002"
|
|
1366
|
+
)
|
|
1367
|
+
});
|
|
1368
|
+
var holdMs = () => t2.duration({
|
|
1369
|
+
default: 2 * 6e4,
|
|
1370
|
+
max: 24 * 36e5,
|
|
1371
|
+
label: L("An error keeps the tile for", "Un error se queda la tesela", "Ein Fehler h\xE4lt die Kachel f\xFCr", "\u51FA\u9519\u540E\u5360\u7528\u683C\u5B50", "\u51FA\u932F\u5F8C\u4F54\u7528\u65B9\u683C"),
|
|
1372
|
+
help: L(
|
|
1373
|
+
"How long after an error the widget stays on its tile (urgent). 0: never.",
|
|
1374
|
+
"Cu\xE1nto tiempo despu\xE9s de un error se queda el widget en su tesela (urgente). 0: nunca.",
|
|
1375
|
+
"Wie lange das Widget nach einem Fehler auf seiner Kachel bleibt (dringend). 0: nie.",
|
|
1376
|
+
"\u51FA\u9519\u540E\u5C0F\u7EC4\u4EF6\u5728\u683C\u5B50\u4E0A\u505C\u7559\u591A\u4E45\uFF08\u7D27\u6025\uFF09\u30020\uFF1A\u4ECE\u4E0D\u3002",
|
|
1377
|
+
"\u51FA\u932F\u5F8C\u5C0F\u5DE5\u5177\u5728\u65B9\u683C\u4E0A\u505C\u7559\u591A\u4E45\uFF08\u7DCA\u6025\uFF09\u30020\uFF1A\u5F9E\u4E0D\u3002"
|
|
1378
|
+
)
|
|
1379
|
+
});
|
|
1380
|
+
var includeWarnings = (def) => t2.boolean({
|
|
1381
|
+
default: def,
|
|
1382
|
+
label: L("Include warnings", "Incluir avisos", "Warnungen einbeziehen", "\u5305\u62EC\u8B66\u544A", "\u5305\u62EC\u8B66\u544A")
|
|
1383
|
+
});
|
|
1384
|
+
function freshError(sources, o, now) {
|
|
1385
|
+
if (!(o.holdMs > 0)) return null;
|
|
1386
|
+
const e = newest(select(collect(sources, "alerts"), { units: o.units, messages: o.messages, level: "error" }), "error");
|
|
1387
|
+
return e && now - e.t < o.holdMs && e.t <= now + 6e4 ? e : null;
|
|
1388
|
+
}
|
|
1389
|
+
var urgent = ({ sources, options, now }) => !!freshError(sources, options, now);
|
|
1390
|
+
var idle = ({ sources, options, now }) => {
|
|
1391
|
+
const w = newest(select(collect(sources, "alerts"), { units: options.units, messages: options.messages, level: "warning" }), "warning");
|
|
1392
|
+
return !w || now - w.t >= QUIET_MS;
|
|
1393
|
+
};
|
|
1394
|
+
function demoSources(now) {
|
|
1395
|
+
const kinds = ["journal", "file", "docker"];
|
|
1396
|
+
return Object.fromEntries(kinds.map((k) => [`logs/${k}`, demoData(k, now)]));
|
|
1397
|
+
}
|
|
1398
|
+
function emptyMessage(ctx, quiet) {
|
|
1399
|
+
const st = statuses(ctx.sources);
|
|
1400
|
+
if (st.some((s) => s.status.state === "following")) return quiet;
|
|
1401
|
+
const bad = st.find((s) => s.status.state === "error") ?? st.find((s) => s.status.state === "waiting");
|
|
1402
|
+
if (bad?.status.message) return bad.status.message;
|
|
1403
|
+
if (!st.length) return ctx.t(L("Waiting for the logs\u2026", "Esperando a los logs\u2026", "Warte auf die Logs\u2026", "\u6B63\u5728\u7B49\u5F85\u65E5\u5FD7\u2026", "\u6B63\u5728\u7B49\u5F85\u65E5\u8A8C\u2026"));
|
|
1404
|
+
return ctx.t(L("Nothing to follow: set a log up in Settings \u2192 Data sources", "Nada que seguir: configura un log en Ajustes \u2192 Fuentes de datos", "Nichts zu verfolgen: richte ein Log unter Einstellungen \u2192 Datenquellen ein", "\u6CA1\u6709\u53EF\u8DDF\u8E2A\u7684\uFF1A\u5728 \u8BBE\u7F6E \u2192 \u6570\u636E\u6E90 \u4E2D\u914D\u7F6E\u65E5\u5FD7", "\u6C92\u6709\u53EF\u8FFD\u8E64\u7684\uFF1A\u5728 \u8A2D\u5B9A \u2192 \u8CC7\u6599\u4F86\u6E90 \u4E2D\u8A2D\u5B9A\u65E5\u8A8C"));
|
|
1405
|
+
}
|
|
1406
|
+
var colorOf = (ctx, l) => {
|
|
1407
|
+
const c = ctx.theme.colors;
|
|
1408
|
+
return l === "error" ? c.alert : l === "warning" ? c.warn : l === "debug" ? c.inkDim : c.ink;
|
|
1409
|
+
};
|
|
1410
|
+
var NARROW = /^[\u0000-ɏ -←-⇿─-╿]*$/;
|
|
1411
|
+
function fitMono(g, ctx, text, maxW, font, cell) {
|
|
1412
|
+
if (maxW <= 0) return "";
|
|
1413
|
+
if (NARROW.test(text) && cell > 0) {
|
|
1414
|
+
const n = Math.floor(maxW / cell);
|
|
1415
|
+
const cut = text.length <= n ? text : n <= 1 ? "\u2026" : `${text.slice(0, n - 1).trimEnd()}\u2026`;
|
|
1416
|
+
if (ctx.kit.measureTracked(g, cut, font) <= maxW + 0.5) return cut;
|
|
1417
|
+
}
|
|
1418
|
+
return ctx.kit.truncate(g, text, maxW, font);
|
|
1419
|
+
}
|
|
1420
|
+
function clipped(g, ctx, paint) {
|
|
1421
|
+
const { box } = ctx;
|
|
1422
|
+
g.save();
|
|
1423
|
+
g.beginPath();
|
|
1424
|
+
g.rect(box.x, box.y, box.w, box.h);
|
|
1425
|
+
g.clip();
|
|
1426
|
+
try {
|
|
1427
|
+
paint();
|
|
1428
|
+
} finally {
|
|
1429
|
+
g.restore();
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
var countLabel = (n) => n > 1 ? `\xD7${n > 9999 ? `${Math.floor(n / 1e3)}k` : n}` : "";
|
|
1433
|
+
var tailOptions = t2.object({
|
|
1434
|
+
level: t2.enum(["error", "warning", "notice", "info", "debug"], {
|
|
1435
|
+
default: "info",
|
|
1436
|
+
label: L("Show", "Mostrar", "Zeigen", "\u663E\u793A", "\u986F\u793A"),
|
|
1437
|
+
labels: {
|
|
1438
|
+
error: L("Errors", "Errores", "Fehler", "\u9519\u8BEF", "\u932F\u8AA4"),
|
|
1439
|
+
warning: L("Warnings and worse", "Avisos y peor", "Warnungen und schlimmer", "\u8B66\u544A\u53CA\u4EE5\u4E0A", "\u8B66\u544A\u53CA\u4EE5\u4E0A"),
|
|
1440
|
+
notice: L("Notices and worse", "Notas y peor", "Hinweise und schlimmer", "\u901A\u77E5\u53CA\u4EE5\u4E0A", "\u901A\u77E5\u53CA\u4EE5\u4E0A"),
|
|
1441
|
+
info: L("Information and worse", "Informaci\xF3n y peor", "Informationen und schlimmer", "\u4FE1\u606F\u53CA\u4EE5\u4E0A", "\u8CC7\u8A0A\u53CA\u4EE5\u4E0A"),
|
|
1442
|
+
debug: L("Everything", "Todo", "Alles", "\u5168\u90E8", "\u5168\u90E8")
|
|
1443
|
+
}
|
|
1444
|
+
}),
|
|
1445
|
+
units: units(),
|
|
1446
|
+
messages: messages(),
|
|
1447
|
+
showUnits: t2.boolean({ default: true, label: L("Show where each line comes from", "Mostrar de d\xF3nde viene cada l\xEDnea", "Zeigen, woher jede Zeile kommt", "\u663E\u793A\u6BCF\u884C\u7684\u6765\u6E90", "\u986F\u793A\u6BCF\u884C\u7684\u4F86\u6E90") }),
|
|
1448
|
+
showTime: t2.boolean({ default: true, label: L("Show how long ago", "Mostrar hace cu\xE1nto", "Zeigen, wie lange her", "\u663E\u793A\u591A\u4E45\u4EE5\u524D", "\u986F\u793A\u591A\u4E45\u4EE5\u524D") }),
|
|
1449
|
+
...listOptions({ layouts: ["one-line", "detailed"] }),
|
|
1450
|
+
holdMs: holdMs()
|
|
1451
|
+
});
|
|
1452
|
+
function tailLines(sources, o) {
|
|
1453
|
+
return fold(select(collect(sources, "lines"), o)).reverse();
|
|
1454
|
+
}
|
|
1455
|
+
var tail = defineWidget({
|
|
1456
|
+
id: "tail",
|
|
1457
|
+
name: L("Live log", "Log en vivo", "Live-Log", "\u5B9E\u65F6\u65E5\u5FD7", "\u5373\u6642\u65E5\u8A8C"),
|
|
1458
|
+
description: L(
|
|
1459
|
+
"The end of your logs as they are written: errors in red, warnings in amber, repeats folded (\xD737), secrets masked.",
|
|
1460
|
+
"El final de tus logs seg\xFAn se escriben: errores en rojo, avisos en \xE1mbar, repeticiones agrupadas (\xD737), secretos ocultos.",
|
|
1461
|
+
"Das Ende deiner Logs, w\xE4hrend sie geschrieben werden: Fehler rot, Warnungen gelb, Wiederholungen zusammengefasst (\xD737), Geheimnisse maskiert.",
|
|
1462
|
+
"\u5B9E\u65F6\u663E\u793A\u65E5\u5FD7\u7684\u672B\u5C3E\uFF1A\u9519\u8BEF\u4E3A\u7EA2\u8272\uFF0C\u8B66\u544A\u4E3A\u7425\u73C0\u8272\uFF0C\u91CD\u590D\u884C\u5408\u5E76\uFF08\xD737\uFF09\uFF0C\u673A\u5BC6\u4FE1\u606F\u5DF2\u906E\u76D6\u3002",
|
|
1463
|
+
"\u5373\u6642\u986F\u793A\u65E5\u8A8C\u7684\u7D50\u5C3E\uFF1A\u932F\u8AA4\u70BA\u7D05\u8272\uFF0C\u8B66\u544A\u70BA\u7425\u73C0\u8272\uFF0C\u91CD\u8907\u884C\u5408\u4F75\uFF08\xD737\uFF09\uFF0C\u6A5F\u5BC6\u8CC7\u8A0A\u5DF2\u906E\u84CB\u3002"
|
|
1464
|
+
),
|
|
1465
|
+
icon: "scroll-text",
|
|
1466
|
+
category: "system",
|
|
1467
|
+
tags: ["logs", "journald", "docker"],
|
|
1468
|
+
size: { min: { w: 240, h: 80 }, preferred: { w: 900, h: 300 } },
|
|
1469
|
+
options: tailOptions,
|
|
1470
|
+
sources: [...SOURCE_IDS],
|
|
1471
|
+
redraw: "minute",
|
|
1472
|
+
urgent,
|
|
1473
|
+
idle,
|
|
1474
|
+
empty: ({ sources, options }) => !tailLines(sources, options).length,
|
|
1475
|
+
render(g, ctx) {
|
|
1476
|
+
const { box, options, theme, kit } = ctx;
|
|
1477
|
+
const lines = tailLines(ctx.sources, options);
|
|
1478
|
+
if (!lines.length) return drawEmpty(g, ctx, emptyMessage(ctx, ctx.t(L("Quiet: no lines to show", "Tranquilo: ninguna l\xEDnea que mostrar", "Ruhig: keine Zeilen zu zeigen", "\u5F88\u5B89\u9759\uFF1A\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C", "\u5F88\u5B89\u975C\uFF1A\u6C92\u6709\u53EF\u986F\u793A\u7684\u884C"))));
|
|
1479
|
+
const plan = listLayout(box, lines.length, options, {
|
|
1480
|
+
sizes: { "one-line": { min: 26, max: 44 }, detailed: { min: 48, max: 76 } },
|
|
1481
|
+
auto: (b, n) => b.w < 480 && b.h / Math.max(1, Math.min(n, 4)) >= 48 ? "detailed" : "one-line",
|
|
1482
|
+
minRows: 6
|
|
1483
|
+
});
|
|
1484
|
+
const detailed = plan.layout === "detailed";
|
|
1485
|
+
const mono = { size: plan.textSize, family: theme.fonts.mono };
|
|
1486
|
+
const small = { size: detailed ? plan.detailSize : Math.max(8, Math.round(plan.textSize * 0.86)), family: theme.fonts.mono };
|
|
1487
|
+
const cell = kit.measureTracked(g, "MMMMMMMMMM", mono) / 10;
|
|
1488
|
+
const smallCell = kit.measureTracked(g, "MMMMMMMMMM", small) / 10;
|
|
1489
|
+
const bar = Math.max(2, Math.round(plan.rowH * 0.12));
|
|
1490
|
+
const pad = bar + Math.max(4, Math.round(cell * 0.6));
|
|
1491
|
+
const gap = Math.max(4, Math.round(cell * 0.8));
|
|
1492
|
+
const ageW = options.showTime && !detailed ? Math.max(smallCell * 6, ...lines.slice(0, plan.shown).map((l) => kit.measureTracked(g, ctx.fmt.ago(l.t, { suffix: false }), small))) : 0;
|
|
1493
|
+
const unitW = options.showUnits && !detailed ? Math.min(smallCell * 16, Math.round(box.w * 0.2), Math.max(...lines.slice(0, plan.shown).map((l) => smallCell * [...l.unit].length))) : 0;
|
|
1494
|
+
clipped(g, ctx, () => {
|
|
1495
|
+
plan.rows.forEach((row, i) => {
|
|
1496
|
+
const l = lines[i];
|
|
1497
|
+
const color = colorOf(ctx, l.level);
|
|
1498
|
+
if (rank(l.level) <= rank("warning")) {
|
|
1499
|
+
g.fillStyle = color;
|
|
1500
|
+
g.fillRect(row.x, row.y + plan.rowH * 0.18, bar, plan.rowH * 0.64);
|
|
1501
|
+
}
|
|
1502
|
+
const count = countLabel(l.count);
|
|
1503
|
+
if (!detailed) {
|
|
1504
|
+
const base = row.y + plan.rowH * 0.5 + plan.textSize * 0.36;
|
|
1505
|
+
let x = row.x + pad;
|
|
1506
|
+
if (ageW) {
|
|
1507
|
+
kit.drawTracked(g, ctx.fmt.ago(l.t, { suffix: false }), x + ageW, base, { ...small, color: theme.colors.inkDim, align: "right" });
|
|
1508
|
+
x += ageW + gap;
|
|
1509
|
+
}
|
|
1510
|
+
if (unitW) {
|
|
1511
|
+
kit.drawTracked(g, fitMono(g, ctx, l.unit, unitW, small, smallCell), x, base, { ...small, color: theme.colors.inkDim });
|
|
1512
|
+
x += unitW + gap;
|
|
1513
|
+
}
|
|
1514
|
+
if (count) {
|
|
1515
|
+
x += kit.drawTracked(g, count, x, base, { ...mono, family: theme.fonts.monoBold, color: theme.colors.accent }) + gap;
|
|
1516
|
+
}
|
|
1517
|
+
kit.drawTracked(g, fitMono(g, ctx, l.msg, row.x + row.w - x, mono, cell), x, base, { ...mono, color });
|
|
1518
|
+
} else {
|
|
1519
|
+
const base = row.y + plan.textSize * 1.05;
|
|
1520
|
+
const x = row.x + pad;
|
|
1521
|
+
kit.drawTracked(g, fitMono(g, ctx, l.msg, row.x + row.w - x, mono, cell), x, base, { ...mono, color });
|
|
1522
|
+
const meta = [options.showUnits ? l.unit : "", options.showTime ? ctx.fmt.ago(l.t) : "", count].filter(Boolean).join(" \xB7 ");
|
|
1523
|
+
if (meta) kit.drawTracked(g, fitMono(g, ctx, meta, row.x + row.w - x, small, smallCell), x, base + plan.detailSize * 1.45, { ...small, color: theme.colors.inkDim });
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
drawMore(g, ctx, plan, { indent: pad });
|
|
1527
|
+
});
|
|
1528
|
+
},
|
|
1529
|
+
demo: ({ now }) => ({ sources: demoSources(now) })
|
|
1530
|
+
});
|
|
1531
|
+
var rateOptions = t2.object({
|
|
1532
|
+
units: units(),
|
|
1533
|
+
messages: messages(),
|
|
1534
|
+
includeWarnings: includeWarnings(false),
|
|
1535
|
+
historyMs: t2.duration({
|
|
1536
|
+
default: 36e5,
|
|
1537
|
+
min: 10 * 6e4,
|
|
1538
|
+
max: 24 * 36e5,
|
|
1539
|
+
label: L("Span", "Periodo", "Zeitraum", "\u65F6\u95F4\u8303\u56F4", "\u6642\u9593\u7BC4\u570D"),
|
|
1540
|
+
help: L("How far back the curve goes (up to 24 h).", "Hasta cu\xE1ndo atr\xE1s llega la curva (hasta 24 h).", "Wie weit die Kurve zur\xFCckreicht (bis 24 h).", "\u66F2\u7EBF\u56DE\u6EAF\u591A\u4E45\uFF08\u6700\u591A 24 \u5C0F\u65F6\uFF09\u3002", "\u66F2\u7DDA\u56DE\u6EAF\u591A\u4E45\uFF08\u6700\u591A 24 \u5C0F\u6642\uFF09\u3002")
|
|
1541
|
+
}),
|
|
1542
|
+
holdMs: holdMs()
|
|
1543
|
+
});
|
|
1544
|
+
var rate = defineWidget({
|
|
1545
|
+
id: "rate",
|
|
1546
|
+
name: L("Errors per minute", "Errores por minuto", "Fehler pro Minute", "\u6BCF\u5206\u949F\u9519\u8BEF\u6570", "\u6BCF\u5206\u9418\u932F\u8AA4\u6578"),
|
|
1547
|
+
description: L(
|
|
1548
|
+
"A curve of the errors in your logs, minute by minute, and how many there were.",
|
|
1549
|
+
"Una curva de los errores de tus logs, minuto a minuto, y cu\xE1ntos hubo.",
|
|
1550
|
+
"Eine Kurve der Fehler in deinen Logs, Minute f\xFCr Minute, und wie viele es waren.",
|
|
1551
|
+
"\u65E5\u5FD7\u4E2D\u9519\u8BEF\u6570\u91CF\u7684\u9010\u5206\u949F\u66F2\u7EBF\uFF0C\u4EE5\u53CA\u603B\u6570\u3002",
|
|
1552
|
+
"\u65E5\u8A8C\u4E2D\u932F\u8AA4\u6578\u91CF\u7684\u9010\u5206\u9418\u66F2\u7DDA\uFF0C\u4EE5\u53CA\u7E3D\u6578\u3002"
|
|
1553
|
+
),
|
|
1554
|
+
icon: "activity",
|
|
1555
|
+
category: "system",
|
|
1556
|
+
tags: ["logs", "errors"],
|
|
1557
|
+
size: { min: { w: 160, h: 80 }, preferred: { w: 480, h: 200 } },
|
|
1558
|
+
options: rateOptions,
|
|
1559
|
+
sources: [...SOURCE_IDS],
|
|
1560
|
+
redraw: "minute",
|
|
1561
|
+
urgent,
|
|
1562
|
+
idle,
|
|
1563
|
+
render(g, ctx) {
|
|
1564
|
+
const { box, options, theme, kit, now } = ctx;
|
|
1565
|
+
const c = theme.colors;
|
|
1566
|
+
const view = { units: options.units, messages: options.messages };
|
|
1567
|
+
const alerts = collect(ctx.sources, "alerts");
|
|
1568
|
+
const errors = select(alerts, { ...view, level: "error" }).filter((l) => l.level === "error");
|
|
1569
|
+
const warnings = options.includeWarnings ? select(alerts, { ...view, level: "warning" }).filter((l) => l.level === "warning") : [];
|
|
1570
|
+
const span = Math.max(10 * 6e4, options.historyMs);
|
|
1571
|
+
const total = errors.filter((l) => l.t > now - span).reduce((a, l) => a + l.count, 0);
|
|
1572
|
+
const fresh = !!freshError(ctx.sources, options, now);
|
|
1573
|
+
const side = box.w >= box.h * 2.2;
|
|
1574
|
+
const numH = side ? Math.min(box.h * 0.5, box.w * 0.16) : Math.min(box.h * 0.34, box.w * 0.22);
|
|
1575
|
+
const plural = ctx.plural;
|
|
1576
|
+
const forms = {
|
|
1577
|
+
en: { one: "error in {span}", other: "errors in {span}" },
|
|
1578
|
+
es: { one: "error en {span}", other: "errores en {span}" },
|
|
1579
|
+
de: { one: "Fehler in {span}", other: "Fehler in {span}" },
|
|
1580
|
+
"zh-Hans": { other: "{span}\u5185\u7684\u9519\u8BEF" },
|
|
1581
|
+
"zh-Hant": { other: "{span}\u5167\u7684\u932F\u8AA4" }
|
|
1582
|
+
};
|
|
1583
|
+
const label = (plural ? plural(total, forms) : ctx.t(Object.fromEntries(Object.entries(forms).map(([k, v]) => [k, v.other])))).replace("{span}", ctx.fmt.duration(span, { compact: true })).replace("{n}", String(total));
|
|
1584
|
+
const big = { size: Math.round(numH), family: theme.fonts.sansBold, color: fresh ? c.alert : total ? c.ink : c.inkDim };
|
|
1585
|
+
const lab = { size: Math.max(9, Math.round(numH * 0.32)), family: theme.fonts.sans, color: c.inkDim };
|
|
1586
|
+
const colW = side ? Math.max(kit.measureTracked(g, String(total), big), Math.min(box.w * 0.3, kit.measureTracked(g, label, lab))) : box.w;
|
|
1587
|
+
clipped(g, ctx, () => {
|
|
1588
|
+
const nSize = kit.fitSize(g, String(total), colW, big, 10);
|
|
1589
|
+
kit.drawTracked(g, String(total), box.x, box.y + nSize * 0.92, { ...big, size: nSize });
|
|
1590
|
+
kit.drawTracked(g, kit.truncate(g, label, colW, lab), box.x, box.y + nSize * 0.92 + lab.size * 1.3, lab);
|
|
1591
|
+
const top = side ? box.y : box.y + nSize * 0.92 + lab.size * 1.9;
|
|
1592
|
+
const left = side ? box.x + colW + Math.max(10, box.w * 0.03) : box.x;
|
|
1593
|
+
const axis = { size: Math.max(8, Math.round(Math.min(box.h * 0.09, 18))), family: theme.fonts.sans, color: c.inkFaint };
|
|
1594
|
+
const curve = { x: left, y: top + axis.size * 1.2, w: box.x + box.w - left, h: box.y + box.h - top - axis.size * 2.6 };
|
|
1595
|
+
if (curve.w < 20 || curve.h < 10) return;
|
|
1596
|
+
const n = Math.max(10, Math.min(120, Math.floor(curve.w / 5), Math.floor(span / 6e4)));
|
|
1597
|
+
const ev = perMinute(errors, now, span, n);
|
|
1598
|
+
const wv = options.includeWarnings ? perMinute(warnings, now, span, n) : [];
|
|
1599
|
+
const max = Math.max(1, ...ev, ...wv);
|
|
1600
|
+
const ceil = max <= 5 ? Math.ceil(max) : Math.ceil(max / 5) * 5;
|
|
1601
|
+
const px = (i) => curve.x + curve.w * i / (n - 1);
|
|
1602
|
+
const py = (v) => curve.y + curve.h - curve.h * v / ceil;
|
|
1603
|
+
const path = (vals) => {
|
|
1604
|
+
g.beginPath();
|
|
1605
|
+
vals.forEach((v, i) => i ? g.lineTo(px(i), py(v)) : g.moveTo(px(i), py(v)));
|
|
1606
|
+
};
|
|
1607
|
+
g.strokeStyle = c.inkFaint;
|
|
1608
|
+
g.lineWidth = 1;
|
|
1609
|
+
g.beginPath();
|
|
1610
|
+
g.moveTo(curve.x, curve.y + curve.h + 0.5);
|
|
1611
|
+
g.lineTo(curve.x + curve.w, curve.y + curve.h + 0.5);
|
|
1612
|
+
g.stroke();
|
|
1613
|
+
const series = [...wv.length ? [[wv, c.warn]] : [], [ev, c.alert]];
|
|
1614
|
+
for (const [vals, color] of series) {
|
|
1615
|
+
path(vals);
|
|
1616
|
+
g.lineTo(px(n - 1), curve.y + curve.h);
|
|
1617
|
+
g.lineTo(px(0), curve.y + curve.h);
|
|
1618
|
+
g.closePath();
|
|
1619
|
+
g.globalAlpha = 0.22;
|
|
1620
|
+
g.fillStyle = color;
|
|
1621
|
+
g.fill();
|
|
1622
|
+
g.globalAlpha = 1;
|
|
1623
|
+
path(vals);
|
|
1624
|
+
g.strokeStyle = color;
|
|
1625
|
+
g.lineWidth = Math.max(1.5, Math.min(3, curve.h / 40));
|
|
1626
|
+
g.lineJoin = "round";
|
|
1627
|
+
g.stroke();
|
|
1628
|
+
}
|
|
1629
|
+
const perMin = ctx.t(L("{n}/min", "{n}/min", "{n}/min", "{n}/\u5206\u949F", "{n}/\u5206\u9418")).replace("{n}", String(ceil));
|
|
1630
|
+
kit.drawTracked(g, perMin, curve.x, curve.y - axis.size * 0.3, axis);
|
|
1631
|
+
const bottom = curve.y + curve.h + axis.size * 1.25;
|
|
1632
|
+
kit.drawTracked(g, `\u2212${ctx.fmt.duration(span, { compact: true })}`, curve.x, bottom, axis);
|
|
1633
|
+
kit.drawTracked(g, ctx.t(L("now", "ahora", "jetzt", "\u73B0\u5728", "\u73FE\u5728")), curve.x + curve.w, bottom, { ...axis, align: "right" });
|
|
1634
|
+
});
|
|
1635
|
+
},
|
|
1636
|
+
demo: ({ now }) => ({ sources: demoSources(now) })
|
|
1637
|
+
});
|
|
1638
|
+
var lastOptions = t2.object({
|
|
1639
|
+
units: units(),
|
|
1640
|
+
messages: messages(),
|
|
1641
|
+
includeWarnings: includeWarnings(false),
|
|
1642
|
+
holdMs: holdMs()
|
|
1643
|
+
});
|
|
1644
|
+
function lastError(sources, o) {
|
|
1645
|
+
const worst = o.includeWarnings ? "warning" : "error";
|
|
1646
|
+
const list = fold(select(collect(sources, "alerts"), { units: o.units, messages: o.messages, level: worst }));
|
|
1647
|
+
const e = list[list.length - 1];
|
|
1648
|
+
if (!e) return null;
|
|
1649
|
+
const run = collect(sources, "lines").find((l) => l.t === e.t && l.msg === e.msg && l.unit === e.unit && l.kind === e.kind && l.level === e.level);
|
|
1650
|
+
return run && run.count > e.count ? { ...e, count: run.count, first: Math.min(run.first, e.first) } : e;
|
|
1651
|
+
}
|
|
1652
|
+
var last = defineWidget({
|
|
1653
|
+
id: "last-error",
|
|
1654
|
+
name: L("Last error", "\xDAltimo error", "Letzter Fehler", "\u6700\u8FD1\u7684\u9519\u8BEF", "\u6700\u8FD1\u7684\u932F\u8AA4"),
|
|
1655
|
+
description: L(
|
|
1656
|
+
"The last error of your logs, big, with where and when: for a small tile.",
|
|
1657
|
+
"El \xFAltimo error de tus logs, en grande, con d\xF3nde y cu\xE1ndo: para una tesela peque\xF1a.",
|
|
1658
|
+
"Der letzte Fehler deiner Logs, gro\xDF, mit wo und wann: f\xFCr eine kleine Kachel.",
|
|
1659
|
+
"\u65E5\u5FD7\u4E2D\u6700\u8FD1\u7684\u4E00\u6761\u9519\u8BEF\uFF0C\u5927\u5B57\u663E\u793A\u6765\u6E90\u548C\u65F6\u95F4\uFF1A\u9002\u5408\u5C0F\u683C\u5B50\u3002",
|
|
1660
|
+
"\u65E5\u8A8C\u4E2D\u6700\u8FD1\u7684\u4E00\u5247\u932F\u8AA4\uFF0C\u5927\u5B57\u986F\u793A\u4F86\u6E90\u8207\u6642\u9593\uFF1A\u9069\u5408\u5C0F\u65B9\u683C\u3002"
|
|
1661
|
+
),
|
|
1662
|
+
icon: "octagon-alert",
|
|
1663
|
+
category: "system",
|
|
1664
|
+
tags: ["logs", "errors"],
|
|
1665
|
+
size: { min: { w: 160, h: 80 }, preferred: { w: 420, h: 200 } },
|
|
1666
|
+
options: lastOptions,
|
|
1667
|
+
sources: [...SOURCE_IDS],
|
|
1668
|
+
redraw: "minute",
|
|
1669
|
+
urgent,
|
|
1670
|
+
idle,
|
|
1671
|
+
empty: ({ sources, options }) => !lastError(sources, options),
|
|
1672
|
+
render(g, ctx) {
|
|
1673
|
+
const { box, options, theme, kit, now } = ctx;
|
|
1674
|
+
const c = theme.colors;
|
|
1675
|
+
const e = lastError(ctx.sources, options);
|
|
1676
|
+
if (!e) return drawEmpty(g, ctx, emptyMessage(ctx, ctx.t(L("No errors", "Sin errores", "Keine Fehler", "\u6CA1\u6709\u9519\u8BEF", "\u6C92\u6709\u932F\u8AA4"))));
|
|
1677
|
+
const fresh = options.holdMs > 0 && now - e.t < options.holdMs;
|
|
1678
|
+
const color = fresh ? colorOf(ctx, e.level) : c.ink;
|
|
1679
|
+
const metaSize = Math.max(10, Math.round(Math.min(28, box.h * 0.15, box.w * 0.07)));
|
|
1680
|
+
const unitFont = { size: metaSize, family: theme.fonts.sansBold, color: fresh ? colorOf(ctx, e.level) : c.inkDim };
|
|
1681
|
+
const metaFont = { size: metaSize, family: theme.fonts.sans, color: c.inkDim };
|
|
1682
|
+
const rest = [ctx.fmt.ago(e.t), countLabel(e.count)].filter(Boolean).join(" \xB7 ");
|
|
1683
|
+
clipped(g, ctx, () => {
|
|
1684
|
+
const restW = kit.measureTracked(g, ` \xB7 ${rest}`, metaFont);
|
|
1685
|
+
const unit = kit.truncate(g, e.unit, Math.max(metaSize * 2, box.w - restW), unitFont);
|
|
1686
|
+
const uw = kit.drawTracked(g, unit, box.x, box.y + metaSize, unitFont);
|
|
1687
|
+
kit.drawTracked(g, kit.truncate(g, ` \xB7 ${rest}`, Math.max(0, box.w - uw), metaFont), box.x + uw, box.y + metaSize, metaFont);
|
|
1688
|
+
const top = box.y + metaSize * 1.6;
|
|
1689
|
+
const room = box.y + box.h - top;
|
|
1690
|
+
const font = { size: 0, family: theme.fonts.sans, color };
|
|
1691
|
+
let size = Math.min(room * 0.5, box.w * 0.12, 72);
|
|
1692
|
+
const min = Math.max(10, Math.min(16, room / 3));
|
|
1693
|
+
let lines = [];
|
|
1694
|
+
for (let i = 0; i < 8; i++) {
|
|
1695
|
+
font.size = Math.max(min, Math.round(size));
|
|
1696
|
+
const max = Math.max(1, Math.floor(room / (font.size * 1.18)));
|
|
1697
|
+
lines = kit.wrapLines(g, e.msg, box.w, max, font);
|
|
1698
|
+
const whole = !lines[lines.length - 1]?.endsWith("\u2026") || e.msg.endsWith("\u2026");
|
|
1699
|
+
if (whole || font.size <= min) break;
|
|
1700
|
+
size *= 0.84;
|
|
1701
|
+
}
|
|
1702
|
+
lines.forEach((ln, i) => kit.drawTracked(g, ln, box.x, top + font.size * (0.95 + i * 1.18), font));
|
|
1703
|
+
});
|
|
1704
|
+
},
|
|
1705
|
+
demo: ({ now }) => ({ sources: demoSources(now) })
|
|
1706
|
+
});
|
|
1707
|
+
var WIDGETS = [tail, rate, last];
|
|
1708
|
+
|
|
1709
|
+
// src/index.ts
|
|
1710
|
+
var index_default = definePlugin({
|
|
1711
|
+
id: "logs",
|
|
1712
|
+
name: L("Logs", "Logs", "Logs", "\u65E5\u5FD7", "\u65E5\u8A8C"),
|
|
1713
|
+
version: "0.1.0",
|
|
1714
|
+
description: L(
|
|
1715
|
+
"Live logs on your panel: journald, log files, Docker, macOS, Windows, Kubernetes and Loki. Errors show as they happen, repeats fold, secrets are masked.",
|
|
1716
|
+
"Logs en vivo en tu panel: journald, archivos de log, Docker, macOS, Windows, Kubernetes y Loki. Los errores aparecen seg\xFAn ocurren, las repeticiones se agrupan y los secretos se ocultan.",
|
|
1717
|
+
"Live-Logs auf deinem Panel: journald, Logdateien, Docker, macOS, Windows, Kubernetes und Loki. Fehler erscheinen sofort, Wiederholungen werden zusammengefasst, Geheimnisse maskiert.",
|
|
1718
|
+
"\u5728\u9762\u677F\u4E0A\u5B9E\u65F6\u67E5\u770B\u65E5\u5FD7\uFF1Ajournald\u3001\u65E5\u5FD7\u6587\u4EF6\u3001Docker\u3001macOS\u3001Windows\u3001Kubernetes \u548C Loki\u3002\u9519\u8BEF\u5373\u65F6\u51FA\u73B0\uFF0C\u91CD\u590D\u884C\u5408\u5E76\uFF0C\u673A\u5BC6\u4FE1\u606F\u88AB\u906E\u76D6\u3002",
|
|
1719
|
+
"\u5728\u9762\u677F\u4E0A\u5373\u6642\u67E5\u770B\u65E5\u8A8C\uFF1Ajournald\u3001\u65E5\u8A8C\u6A94\u3001Docker\u3001macOS\u3001Windows\u3001Kubernetes \u8207 Loki\u3002\u932F\u8AA4\u5373\u6642\u51FA\u73FE\uFF0C\u91CD\u8907\u884C\u5408\u4F75\uFF0C\u6A5F\u5BC6\u8CC7\u8A0A\u88AB\u906E\u84CB\u3002"
|
|
1720
|
+
),
|
|
1721
|
+
author: "Loksly",
|
|
1722
|
+
license: "MIT",
|
|
1723
|
+
homepage: "https://github.com/kiosko-lcd/kiosko-plugin-logs#readme",
|
|
1724
|
+
repository: "https://github.com/kiosko-lcd/kiosko-plugin-logs",
|
|
1725
|
+
icon: "scroll-text",
|
|
1726
|
+
sdk: "^0.2.0",
|
|
1727
|
+
languages: LANGUAGES,
|
|
1728
|
+
permissions: {
|
|
1729
|
+
exec: ["journalctl", "log", "powershell", "kubectl", "user"],
|
|
1730
|
+
files: ["user"],
|
|
1731
|
+
network: ["user"],
|
|
1732
|
+
devices: ["docker", "journald"]
|
|
1733
|
+
},
|
|
1734
|
+
widgets: WIDGETS,
|
|
1735
|
+
sources: SOURCES
|
|
1736
|
+
});
|
|
1737
|
+
export {
|
|
1738
|
+
index_default as default,
|
|
1739
|
+
docker,
|
|
1740
|
+
file,
|
|
1741
|
+
journal,
|
|
1742
|
+
kubernetes,
|
|
1743
|
+
last,
|
|
1744
|
+
loki,
|
|
1745
|
+
macos,
|
|
1746
|
+
mask,
|
|
1747
|
+
rate,
|
|
1748
|
+
tail,
|
|
1749
|
+
windows
|
|
1750
|
+
};
|