claude: add a skill for reading fleet logs from VictoriaLogs #1483

Merged
JakeHillion merged 1 commits from jj/xmnrmsovktks into main 2026-12-03 19:19:05 +00:00
+43
View File
@@ -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/).