[$25 BOUNTY] [Perl] Add log watchdog malformed JSON fixture coverage#24
Open
leo202000 wants to merge 2 commits into
Open
[$25 BOUNTY] [Perl] Add log watchdog malformed JSON fixture coverage#24leo202000 wants to merge 2 commits into
leo202000 wants to merge 2 commits into
Conversation
…tput
- Add --scan mode to log_watchdog.pl: process log files once and exit
(non-daemon), suitable for CI and fixture testing.
- Add --json-summary flag: output JSON summary with json_lines count,
malformed_json count, alerts_sent, and pattern_matches.
- Add JSON line detection in process_line: lines starting with '{' are
parsed with JSON::PP; malformed JSON is counted but does not crash.
- Exit code 1 when malformed JSON detected, 0 otherwise.
- Make File::Tail optional (not needed for --scan mode).
- Fix pre-existing compile errors: add MAGIC_NUMBER_47 constant,
fix \ and \ bareword usage under strict.
- Add v2/scripts/test_watchdog_fixtures.pl: 25 tests covering valid
JSON, malformed JSON, mixed input, plain text, empty files, exit
codes, and JSON field completeness.
- Document --scan/--json-summary in docs/OPERATIONS.md.
Closes #6
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.
Summary
Adds malformed JSON fixture coverage for the v2 log watchdog summary output, as requested in issue #6.
Changes
v2/scripts/log_watchdog.pl:--scanmode: process log files once and exit (non-daemon), suitable for CI and fixture testing.--json-summaryflag: output JSON summary withjson_linescount,malformed_jsoncount,alerts_sent,version, andpattern_matches.process_line: lines starting with{are parsed withJSON::PP; malformed JSON is counted but does not crash the watchdog.File::Tailoptional (not needed for--scanmode).MAGIC_NUMBER_47constant, fix$PID_FILEand$DEFAULT_CONFIGbareword usage underuse strict.v2/scripts/test_watchdog_fixtures.pl(new): 25 tests covering:docs/OPERATIONS.md: Documented--scan/--json-summaryusage, JSON output format, malformed JSON handling, and fixture test command.Testing
perl v2/scripts/test_watchdog_fixtures.pl— 25 tests, all pass (WSL Ubuntu, Perl 5.38.2)python3 build.py— diagnostic build log generated and included belowChecklist
diagnostic/build-9fcca4fe.logd)Closes #6