Skip to content

Add osquery results parser (JSON) - #38

Merged
copyleftdev merged 1 commit into
mainfrom
feat/osquery
May 31, 2026
Merged

copyleftdev merged 1 commit into
mainfrom
feat/osquery

Conversation

@copyleftdev

Copy link
Copy Markdown
Owner

Implements the osquery results plugin — issue #14.

What

osquery's results log is NDJSON. Each line carries query metadata (name,
hostIdentifier, unixTime, action) plus result data in either a
differential columns object (one result row) or a snapshot array (many
result rows). OsqueryParser emits one row per result:

  • metadata columns, plus
  • the result fields under a columns.<key> prefix — so a query column named
    name doesn't collide with the query name.

osquery stringifies every column value, so those are type-coerced (pid
"123" → Int), which lets structural/dist read fleet-posture drift
against a baseline snapshot (a new column value / field surfaces automatically).

Routing

  • Detected by the hostIdentifier + (columns object | snapshot array)
    signature, registered before NDJSON so an osquery stream claims itself first.
  • Claims no extension (the results log is generically *.log).

Errors

Non-object / non-JSON lines are clean AxError::Parse.

Gates

  • fmt / clippy -D warnings / full workspace tests green (both feature sets).
  • Mutation gate: 0 surviving mutants on osquery.rs. The extensions() →
    empty-slice mutant is a documented equivalent (same as the other
    signature-only parsers).
  • Smoke: a snapshot expands to one row per element; an added listening port /
    new column field surfaces as structural drift vs a baseline (exit 1).

Closes #14

🤖 Generated with Claude Code

New OsqueryParser in ax-normalize. osquery's results log is NDJSON; each line
carries query metadata (name, hostIdentifier, unixTime, action) plus result data
in either a differential columns object (one result row) or a snapshot array
(many result rows). We emit one row per result: metadata columns plus the result
fields under a columns.<key> prefix (so a query column named name does not
collide with the query name). osquery stringifies every column value, so those
are type-coerced (pid "123" -> Int), which lets structural/dist read
fleet-posture drift against a baseline snapshot.

Detected by the hostIdentifier + (columns object | snapshot array) signature,
registered before NDJSON so an osquery stream claims itself first. Claims no
extension (the results log is generically *.log). Non-object / non-JSON lines are
a clean Parse error.

Mutation gate: 0 surviving mutants on the new file. The extensions() ->
empty-slice mutant is a documented equivalent (same as the other signature-only
parsers).

Closes #14

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@copyleftdev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 19 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 976e96bf-f539-40ce-a4b0-9eab95aca423

📥 Commits

Reviewing files that changed from the base of the PR and between 2a589a1 and dcb90af.

📒 Files selected for processing (4)
  • .cargo/mutants.toml
  • crates/ax-normalize/src/parser.rs
  • crates/ax-normalize/src/parsers/mod.rs
  • crates/ax-normalize/src/parsers/osquery.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/osquery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@copyleftdev
copyleftdev merged commit 0777c56 into main May 31, 2026
2 checks passed
@copyleftdev
copyleftdev deleted the feat/osquery branch May 31, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an osquery results parser (JSON)

1 participant