Skip to content

[P2.3-T02] Add activity statistics to cch explain rule #49

@RichardHightower

Description

@RichardHightower

Task: Add activity statistics to cch explain rule

Phase: 2.3 - CLI Enhancements
Estimated: 0.5 day
File: cch_cli/src/cli/explain.rs
Depends on: P2.3-T01, P2.2-T03

Description

Parse recent log entries to display activity statistics for a rule.

Acceptance Criteria

  • Parse recent log entries for the rule
  • Count total triggers
  • Count blocks/warns/audits
  • Find last trigger timestamp
  • Display in cch explain rule output
  • Add --no-stats flag to skip log parsing

Output Format

Recent Activity:
  Triggered: 14 times
  Blocked: 3 times
  Warned: 2 times
  Audited: 9 times
  Last trigger: 2025-01-20 14:32

Performance Note

Add size check to skip log parsing if log file > 10MB, or use --no-stats flag.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions