Skip to content

feat/configuration2.0: identifiers for variables and events#114

Merged
ipmach merged 1 commit intodevelopmentfrom
feat/configuration2.0
Mar 31, 2026
Merged

feat/configuration2.0: identifiers for variables and events#114
ipmach merged 1 commit intodevelopmentfrom
feat/configuration2.0

Conversation

@viktorbeck98
Copy link
Copy Markdown
Collaborator

Summary

  • Named wildcards in templates: Users can now write <pid> instead of <*> so variables have meaningful names rather than requiring positional counting. All named templates are compiled to the existing <*> format at load time — zero runtime changes.
  • Named event IDs in CSV templates: An optional EventId column in .csv template files lets users assign stable string identifiers (e.g. login_failure) to events instead of counting row positions.
  • Compile step for detector configs: TemplateMatcher.compile_detector_config(events_config) resolves string pos labels and string event keys to their positional int equivalents before the pipeline starts, keeping get_configured_variables() and ParserSchema unchanged.
  • Backward compatible: Existing <*> templates and integer event/variable keys continue to work without modification.

Test plan

  • uv run pytest -q — 301 passed, 6 skipped
  • uv run prek run -a — all hooks pass
  • TestCompileTemplates — named wildcard compilation, mixing validation
  • TestNamedWildcardsTxt.txt named wildcards, compile_detector_config resolution, unknown label error
  • TestNamedEventIdCsv.csv EventId column, named event key resolution, positional int keys still work
  • TestNamedVariablesRoundtrip — YAML → Pydantic → YAML → Pydantic identity for named pos and named event ID configs

Related Issues

Fixes #83 and #82

… matcher

Users can now write <label> instead of <*> in template files to give
wildcards meaningful names, and use an EventId column in CSV template
files to assign stable string identifiers to events. Both formats are
compiled to the existing positional representation at load time, so all
runtime code (ParserSchema, get_configured_variables) is unchanged.

- _compile_templates(): converts <label> → <*> and records label order
  and per-template event ID labels (from CSV EventId column)
- TemplatesManager / TemplateMatcher: accept metadata; expose
  compile_detector_config() to resolve string pos labels and string
  event keys to positional ints before pipeline startup
- Variable.pos: str | int (string = named label, compiled to int)
- Variable.name: optional (defaults to empty; label serves as name)
- load_templates(): returns (templates, event_id_labels); CSV files
  support an optional EventId column for named event IDs (.txt files
  remain positional-only)
- Tests and test fixtures for all new paths; roundtrip tests confirm
  string pos and string event keys survive YAML → Pydantic → YAML

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@viktorbeck98 viktorbeck98 requested a review from ipmach March 31, 2026 13:48
@viktorbeck98 viktorbeck98 self-assigned this Mar 31, 2026
@viktorbeck98 viktorbeck98 added the enhancement New feature or request label Mar 31, 2026
@viktorbeck98 viktorbeck98 changed the title # feat/configuration2.0: identifiers for variables and events feat/configuration2.0: identifiers for variables and events Mar 31, 2026
Copy link
Copy Markdown
Contributor

@ipmach ipmach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@ipmach ipmach merged commit e7f0bf7 into development Mar 31, 2026
4 checks passed
@ipmach ipmach deleted the feat/configuration2.0 branch March 31, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants