Skip to content

Fix/11849 Disable Suricata log and syslog logging v1 (keep it in verbose mode) - #44

Closed
KEIAHNY wants to merge 1 commit into
mainfrom
11849-fix-syslog-suricata-log-v1
Closed

KEIAHNY wants to merge 1 commit into
mainfrom
11849-fix-syslog-suricata-log-v1

Conversation

@KEIAHNY

@KEIAHNY KEIAHNY commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

PR Type

Bug fix, Tests


Description

  • Disable Suricata file/syslog logging unless verbose mode

  • Add disable_loggging helper to yaml module

  • Add unit tests for yaml logging functions

  • Add Suricata config fixture for tests


Diagram Walkthrough

flowchart LR
  main["main.rs startup"] -- "not verbose" --> disable["yaml::disable_loggging"]
  disable -- "set enabled: no" --> outputs["logging.outputs: file, syslog"]
  tests["yaml_tests.rs"] -- "verify behavior" --> disable
Loading

File Walkthrough

Relevant files
Bug fix
main.rs
Disable logging in non-verbose mode                                           

src/main.rs

  • Call yaml::disable_loggging when verbose flag is off
  • Panic with error message if disabling logging fails
+7/-0     
Enhancement
yaml.rs
Add function to disable file/syslog logging                           

src/yaml.rs

  • Add public disable_loggging function
  • Set enabled: no for file and syslog logging outputs
  • Return error when logging outputs section is missing
+22/-0   
Tests
yaml_tests.rs
Add unit tests for yaml module                                                     

tests/yaml_tests.rs

  • Add tests for open_yaml with existing and missing files
  • Add tests for disable_loggging success and error cases
  • Verify console output remains enabled
+62/-0   
suricata.yaml
Add Suricata config test fixture                                                 

tests/suricata.yaml

  • Add full Suricata 9.0 configuration as test fixture
  • Includes logging outputs section used by tests
+2378/-0

@KEIAHNY KEIAHNY self-assigned this Oct 22, 2026
@KEIAHNY

KEIAHNY commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Pipeline failed.

@KEIAHNY KEIAHNY closed this Oct 22, 2026
@KEIAHNY
KEIAHNY deleted the 11849-fix-syslog-suricata-log-v1 branch October 22, 2026 20:51
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

⚠️ Review coverage: The following files were not included in this review because of the token budget:

  • tests/suricata.yaml

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Replace panic with graceful exit

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.

src/main.rs [57-61]

     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.

src/yaml.rs [667]

-pub fn disable_loggging(suricata_string: &mut Value) -> Result<(), String> {
+pub fn disable_logging(suricata_string: &mut Value) -> Result<(), String> {
Suggestion importance[1-10]: 4

__

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant