osquery
$ osqueryi Foundation Low Riskosquery (osqueryi) exposes operating system state—processes, open sockets, kernel extensions, users, installed packages, and certificates—as SQLite virtual tables. Passing --json with a SQL SELECT query gives agents strictly read-only, field-filtered endpoint telemetry with zero mutation risk.
brew install osquery osqueryi --json queries local OS tables in milliseconds via SQL with built-in column selection, needing no MCP intermediary.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Single-argument SQL execution with --json / --csv, SQL SELECT field filtering, and self-describing osquery_registry / .schema tables.
- Native
--jsonand SQL column projection - Self-describing
osquery_registryandPRAGMA table_info()
Strictly read-only virtual SQL tables with zero OS mutation capabilities; note unbounded file table queries can consume CPU/IO.
- Read-only virtual table engine
Official packages via brew install osquery and osquery.io installers across macOS, Linux, and Windows.
- Multi-OS native builds at osquery.io/downloads
Replaces dozens of ad-hoc ps, lsof, netstat, and package-manager parsers with one typed SQL JSON interface.
- Unified SQL over 250+ OS telemetry tables
Linux Foundation project originally created by Facebook with strong enterprise adoption.
- Linux Foundation / osquery repository
Searchable schema docs per OS and version on osquery.io and ReadTheDocs.
- Schema reference at osquery.io/schema
Security, Auth & Guardrails
None required; reads local OS APIs and procfs/sysfs tables.
100% free, offline, and open-source (Apache-2.0 OR GPL-2.0).
# osquery Agent Rules - Always pass `--json` and a SQL query argument so `osqueryi` exits immediately instead of opening an interactive REPL. - Use explicit `SELECT` columns and `LIMIT` clauses to avoid scanning huge `file` or `hash` tables unboundedly.
Agent-Ready Command Recipes
Safe Read-Only Queries
osqueryi --json "SELECT lp.pid, p.name, lp.port, lp.address FROM listening_ports lp JOIN processes p USING (pid) WHERE lp.port > 0 LIMIT 25;"
Joins listening_ports and processes in a single read-only SQL query and emits JSON rows.
osqueryi --json "SELECT name FROM osquery_registry WHERE registry = 'table' AND active = 1 ORDER BY name;"
Discovers active virtual tables on the current OS for self-describing agent queries.
Strengths for Agents
- + Unified read-only SQL interface with
--jsonacross processes, sockets, users, packages, and certs. - + Self-describing schema (
PRAGMA table_info,osquery_registry) lets agents discover fields dynamically.
Caveats & Pitfalls
- ! Invoking
osqueryiwith no query argument enters an interactive REPL. - ! Certain tables require root/
sudofor full visibility (e.g., other users' sockets) and unboundedfilequeries can be slow.