Feat/11856 generic visualisation v3 - #42
Open
Davihan11 wants to merge 1 commit into
Open
Conversation
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
There was a problem hiding this comment.
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.pyCLI tool to extract and plot.statscounters over time or by traffic multiplier, with--deltasupport. - 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 on lines
+185
to
+187
| filter_expr = _normalize_filter(filter_expr) | ||
| compiled = jq.compile(filter_expr) | ||
| filtered: List[dict] = [] |
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 on lines
+274
to
+276
| if x_value is None or y_value is None: | ||
| continue | ||
| points.append((x_value, y_value)) |
Collaborator
Author
|
Further testing is required |
Collaborator
|
An image of the produced result would be nice to get a quick idea of what to expect from the code. |
Collaborator
Author
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







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: