Skip to content

Feat/11856 generic visualisation v3 - #42

Open
Davihan11 wants to merge 1 commit into
CESNET:mainfrom
Davihan11:feat/11856-generic-visualisation-v3
Open

Feat/11856 generic visualisation v3#42
Davihan11 wants to merge 1 commit into
CESNET:mainfrom
Davihan11:feat/11856-generic-visualisation-v3

Conversation

@Davihan11

Copy link
Copy Markdown
Collaborator

Add a standalone tool to plot Suricata counter values from eve.json/eve-stats.json files. It reads JSON-lines, keeps the stats event records, optionally filters them with a universal jq filter, and plots the requested counter paths over time (or against the traffic multiplier with --by-multiplier).

Key features:

  • Universal jq filter with automatic leading-dot normalization for bare field identifiers (e.g. 'uptime > 30' -> '.uptime > 30')
  • Correct series alignment: x and y extracted from the same record
  • --delta mode to show per-interval rates instead of cumulative values
  • --by-multiplier mode to plot a summary value against the multiplier
  • NaN handling in plots; empty/all-NaN series produce no figure
  • Robust error handling and informative diagnostics (typo detection, warn-once for insufficient --delta points)
  • Documented in README with usage examples

Add a standalone tool to plot Suricata counter values from
eve.json/eve-stats.json files. It reads JSON-lines, keeps the stats
event records, optionally filters them with a universal jq filter, and
plots the requested counter paths over time (or against the traffic
multiplier with --by-multiplier).

Key features:
- Universal jq filter with automatic leading-dot normalization for bare
  field identifiers (e.g. 'uptime > 30' -> '.uptime > 30')
- Correct series alignment: x and y extracted from the same record
- --delta mode to show per-interval rates instead of cumulative values
- --by-multiplier mode to plot a summary value against the multiplier
- NaN handling in plots; empty/all-NaN series produce no figure
- Robust error handling and informative diagnostics (typo detection,
  warn-once for insufficient --delta points)
- Documented in README with usage examples

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a standalone visualization utility to the Suricata Test Suite for plotting counter values from eve.json / eve-stats.json (JSON-lines) with optional jq-based filtering, plus README documentation so users can discover and use it.

Changes:

  • Introduces util/visualize.py CLI tool to extract and plot .stats counters over time or by traffic multiplier, with --delta support.
  • Adds universal jq filtering with “bare identifier” normalization (e.g. uptime > 30.uptime > 30).
  • Documents the tool and usage examples in README.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
util/visualize.py New plotting CLI for Suricata stats counters (jq filter, delta mode, multiplier mode, plotting).
README.md Adds a new section documenting util/visualize.py usage and options.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread util/visualize.py
Comment on lines +185 to +187
filter_expr = _normalize_filter(filter_expr)
compiled = jq.compile(filter_expr)
filtered: List[dict] = []
Comment thread util/visualize.py
Comment on lines +219 to +220
# Preserve any leading whitespace so it is not lost when we prepend the
# dot to the first identifier token (e.g. ' uptime > 30' -> '.uptime > 30').
Comment thread util/visualize.py
Comment on lines +274 to +276
if x_value is None or y_value is None:
continue
points.append((x_value, y_value))
@Davihan11 Davihan11 self-assigned this Aug 11, 2026
@Davihan11 Davihan11 added the enhancement New feature or request label Aug 12, 2026
@Davihan11

Copy link
Copy Markdown
Collaborator Author

Further testing is required

@matyas7dub

Copy link
Copy Markdown
Collaborator

An image of the produced result would be nice to get a quick idea of what to expect from the code.

@Davihan11

Copy link
Copy Markdown
Collaborator Author

An image of the produced result would be nice to get a quick idea of what to expect from the code.

obrázok

@Davihan11

Copy link
Copy Markdown
Collaborator Author
obrázok obrázok obrázok obrázok obrázok obrázok

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.

3 participants