Phase 1: Windows log collection + full-text search

Extends the agent, ingest, storage, api, and web with Windows Event
Log/ETW sourcing and Tantivy-backed free-text search, per the approved
Phase 1 plan.

- CLAUDE.md: materialized on disk (never existed as a file before) with
  a new Phase 1 "done looks like" section.
- agent: Windows Event Log (EvtSubscribe) and ETW sources, Windows
  service wrapper (install/uninstall/run-service), both feature- and
  target_os-gated so Linux builds/tests/clippy stay unaffected. Also
  fixed two pre-existing Phase 0 clippy gaps (dead-code on
  default-features-only builds, a type-inference edge case) found while
  testing every feature combination properly for the first time.
  UNVERIFIED on real Windows -- no Windows toolchain existed anywhere in
  the build environment; flagged prominently in three places.
- proto/ingest: new record_id field, assigned once server-side in
  ingest's gRPC front end so ClickHouse and Tantivy agree on the same ID
  for the same record.
- storage: record_id column + bloom filter index, verified against a
  live ClickHouse.
- search: new service, Tantivy index, rskafka consumer as an independent
  second consumer group on the same Redpanda topic ingest already reads.
- api/web: new /search endpoint and page, sharing the query page's
  result-table shape and component.
- hack/windows-fixture: sends realistic Windows-shaped data straight to
  ingest, so the pipeline's handling of it is verifiable without a
  Windows host.

Verified end-to-end on the live docker-compose stack: the same record_id
comes back from both /query and /search for the same log line, including
for windows-fixture's synthetic Windows Event Log data. Real bugs found
and fixed along the way: api/Dockerfile missing proto/ in its build
context, search's logs being completely silent (RUST_LOG gap), and
search/target/ missing from .gitignore/.dockerignore.
This commit is contained in:
2026-08-13 11:27:35 -07:00
parent fe854b1091
commit cd8aa290ca
66 changed files with 6084 additions and 171 deletions
+36 -3
View File
@@ -1,12 +1,18 @@
# Phase 0 stack: Redpanda -> ingest -> ClickHouse -> api -> web.
# Phase 0+1 stack: Redpanda -> ingest -> ClickHouse -> api -> web, plus
# search (Tantivy full-text indexing, reads the same Redpanda topic
# ingest's consumer does).
#
# Does NOT include the Rust agent — see /agent/README.md: journald
# sourcing needs the host's journal, which isn't something a container
# gets for free. Run the agent natively on the host per
# /docs/phase-0-runbook.md, pointed at ingest's mapped port (localhost:4317).
# Windows Event Log/ETW sourcing needs a real Windows host regardless —
# see /docs/phase-1-runbook.md.
#
# Before first run: generate dev mTLS certs (hack/dev-certs/generate.sh).
# See /docs/phase-0-runbook.md for the full sequence.
# See /docs/phase-0-runbook.md (Linux pipeline) and
# /docs/phase-1-runbook.md (Windows + full-text search) for the full
# sequences.
services:
redpanda:
image: docker.redpanda.com/redpandadata/redpanda:v24.2.7
@@ -44,6 +50,10 @@ services:
environment:
REDPANDA_BROKERS: "redpanda:9092"
REDPANDA_ADMIN_HOSTS: "redpanda:9644"
# Explicit rather than relying on both this script's and /search's
# defaults happening to agree — search consumes this same topic and
# needs to know the partition count up front (see /search/README.md).
REDPANDA_TOPIC_PARTITIONS: "6"
clickhouse:
image: clickhouse/clickhouse-server:24.8
@@ -109,9 +119,30 @@ services:
volumes:
- ./hack/dev-certs/out:/etc/sentry-ingest:ro
# Reads the same sentry.logs.raw topic ingest's consumer does (own
# offset tracking, own failure domain — see /search/README.md) and
# builds a Tantivy full-text index over the message field.
search:
build:
context: . # needs both search/ and proto/
dockerfile: search/Dockerfile
container_name: sentry-search
depends_on:
redpanda-provision:
condition: service_completed_successfully
environment:
REDPANDA_BROKERS: "redpanda:9092"
REDPANDA_TOPIC_PARTITIONS: "6" # must match redpanda-provision's above
# tracing-subscriber's default filter suppresses INFO without this
# -- found by actually checking `docker compose logs search` and
# seeing nothing, same silent-logging gap the agent had in Phase 0.
RUST_LOG: "info"
volumes:
- search-index-data:/var/lib/sentry-search
api:
build:
context: .
context: . # needs both api/ and proto/ (gRPC client to search)
dockerfile: api/Dockerfile
container_name: sentry-api
depends_on:
@@ -122,6 +153,7 @@ services:
environment:
CLICKHOUSE_ADDR: "clickhouse:9000"
CLICKHOUSE_PASSWORD: "sentry-dev-only"
SEARCH_GRPC_ADDR: "search:50052"
web:
build:
@@ -141,3 +173,4 @@ services:
volumes:
redpanda-data:
clickhouse-data:
search-index-data: