You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix/11849 Disable Suricata log and syslog logging v1 (keep it in verbose mode) - #44
Using panic! for a configuration error in main is too aggressive. It is better to print the error to stderr and exit with a non-zero status code to provide a cleaner user experience.
if !args.verbose {
if let Err(e) = yaml::disable_loggging(&mut suricata_string) {
- panic!("{e}");+ eprintln!("Error disabling logging: {e}");+ std::process::exit(1);
}
}
Suggestion importance[1-10]: 5
__
Why: Replacing panic! with eprintln! and std::process::exit(1) in the main function provides a cleaner error message to the user by avoiding the panic stack trace.
Low
Fix typo in function name
The function name disable_loggging contains a typo (triple 'g'). It should be renamed to disable_logging for correctness and maintainability.
Why: The function name disable_loggging indeed contains a typo. While this is a maintainability/style issue, it is a valid correction.
Low
⚠️Suggestion coverage: Partial input coverage: 1 file(s) had patches clipped before analysis to fit the token budget: tests/suricata.yaml.
Author self-review: I have reviewed the PR code suggestions, and addressed the relevant ones.
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
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.
PR Type
Bug fix, Tests
Description
Disable Suricata file/syslog logging unless verbose mode
Add
disable_loggginghelper to yaml moduleAdd unit tests for yaml logging functions
Add Suricata config fixture for tests
Diagram Walkthrough
File Walkthrough
main.rs
Disable logging in non-verbose modesrc/main.rs
yaml::disable_logggingwhen verbose flag is offyaml.rs
Add function to disable file/syslog loggingsrc/yaml.rs
disable_logggingfunctionenabled: noforfileandsysloglogging outputsyaml_tests.rs
Add unit tests for yaml moduletests/yaml_tests.rs
open_yamlwith existing and missing filesdisable_logggingsuccess and error casessuricata.yaml
Add Suricata config test fixturetests/suricata.yaml