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 v2 (keep it in verbose mode) - #45
Using panic! for a configuration error in main is too aggressive and provides a poor user experience. Replace it with a proper error message printed to stderr and exit with a non-zero status code.
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) provides a cleaner error message to the user, which is better practice for CLI applications.
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.
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 toyamlmoduleAdd unit tests with Suricata config fixture
Diagram Walkthrough
File Walkthrough
main.rs
Disable logging when verbose mode is offsrc/main.rs
yaml::disable_logggingwhen verbose flag is offyaml.rs
Add function to disable file and syslog outputssrc/yaml.rs
disable_logggingfunctionenabled: noforfileandsysloglogging outputsyaml_tests.rs
Add unit tests for yaml logging functionstests/yaml_tests.rs
file/syslogdisabled,consoleuntouchedsuricata.yaml
Add Suricata config fixture for teststests/suricata.yaml