From 50ed960491e1be6a7782b12b5b719d936bd3ff8b Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Mon, 30 Nov 2026 21:56:14 +0000 Subject: [PATCH] claude: add a skill for reading fleet logs from VictoriaLogs Agents read a host's logs by SSHing in and running journalctl, which needs SSH access to every host they look at and an approval for each command. On tmpfs hosts it also misses everything before the last reboot. A project skill points agents working in this repo at VictoriaLogs for any question about a host's logs, including searches across the whole fleet. LogsQL is unfamiliar, so it carries tested example queries for the common cases and the field quirks that differ from journalctl, and links the LogsQL reference for anything else. Test plan: - Ran every example query against VictoriaLogs from this machine - Checked the field names against /select/logsql/field_names and systemd's unit messages for the UNIT field --- .claude/skills/victorialogs/SKILL.md | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .claude/skills/victorialogs/SKILL.md diff --git a/.claude/skills/victorialogs/SKILL.md b/.claude/skills/victorialogs/SKILL.md new file mode 100644 index 00000000..208d27fa --- /dev/null +++ b/.claude/skills/victorialogs/SKILL.md @@ -0,0 +1,43 @@ +--- +name: victorialogs +description: The journal of every fleet host, queryable over HTTP with no access to the host and kept far longer than the hosts keep their own. Use it for any question about a host's logs, or to search every host's logs at once. +--- + +# Fleet logs in VictoriaLogs + +Query `https://victorialogs.neb.jakehillion.me/select/logsql/query` with +LogsQL. It returns one JSON object per line, with every value a string, even +counts. Each entry carries all its journald fields, so trim them with `fields`: + +``` +curl -s https://victorialogs.neb.jakehillion.me/select/logsql/query --data-urlencode 'query=_time:1h _HOSTNAME:iceman _SYSTEMD_UNIT:gitea.service | fields _time, _msg | sort by (_time) | limit 100' +``` + +`_msg` is the message, and `_HOSTNAME` is the short name, not the FQDN. +systemd's own messages about a unit, such as start failures, come from +`init.scope` and name the unit in `UNIT`. + +Results come back unordered, so sort before `limit`. Useful queries: + +``` +# A phrase, in a fixed window +_time:[2026-11-30T20:00:00Z, 2026-11-30T21:00:00Z) _HOSTNAME:phoenix "collation version" + +# A regex over the message +_time:1h _msg:~"(?i)timed? ?out" + +# What systemd did to a unit, newest first +_time:1d _SYSTEMD_UNIT:init.scope UNIT:caddy.service | sort by (_time) desc + +# Errors and worse, counted per host +_time:1d PRIORITY:<=3 | stats by (_HOSTNAME) count() errors + +# Units that failed across the fleet +_time:1d _SYSTEMD_UNIT:init.scope _msg:"Failed with result" | stats by (_HOSTNAME, UNIT) count() n | sort by (n) desc + +# Boots of a host, from its boot IDs +_time:7d _HOSTNAME:iceman | stats by (_BOOT_ID) min(_time) first, max(_time) last +``` + +For anything else, see the +[LogsQL reference](https://docs.victoriametrics.com/victorialogs/logsql/). -- 2.55.0