Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow/output: log triggered exception policies - v3 #12710

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jufajardini
Copy link
Contributor

Changes (if applicable):

  • I have updated the User Guide (in doc/userguide/) to reflect the changes made
  • I have updated the JSON schema (in etc/schema.json) to reflect all logging changes (including schema descriptions)

Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/6215

Previous PR: #12700

Output sample, when policies are triggered:

{
  "pkts_toserver": 18,
  "pkts_toclient": 14,
  "bytes_toserver": 2146,
  "bytes_toclient": 7452,
  "start": "2019-05-15T08:11:18.738996+0000",
  "end": "2019-05-15T08:11:19.256052+0000",
  "age": 1,
  "state": "closed",
  "reason": "shutdown",
  "alerted": false,
  "exception_policy_triggered": [
    {
      "target": "stream_reassembly_memcap",
      "policy": "pass_packet"
    },
    {
      "target": "app_layer_error",
      "policy": "ignore"
    }
  ]
}

Describe changes:

  • fix unsigned int unassigned and without specified length warnings
  • cast uint to enum ExceptionPolicyTarget

Changes in previous PR:

  • change approach for logging exception policies to the flow event, now allowing for more than one triggered policy to be logged for the same flow
    -- this includes some implementation changes to accommodate that
  • incorporate feedback from previous PR
    -- this includes an attempt at rearranging the Flow struct -- used pahole to check for holes and struct size. Size remains the same as before the change, from what I could compare

Provide values to any of the below to override the defaults.

SV_BRANCH=OISF/suricata-verify#2332

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 54.32099% with 37 lines in your changes missing coverage. Please review.

Project coverage is 80.72%. Comparing base (93bd193) to head (b5a7089).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12710      +/-   ##
==========================================
+ Coverage   80.71%   80.72%   +0.01%     
==========================================
  Files         936      936              
  Lines      259393   259474      +81     
==========================================
+ Hits       209368   209463      +95     
+ Misses      50025    50011      -14     
Flag Coverage Δ
fuzzcorpus 56.97% <54.32%> (-0.01%) ⬇️
livemode 19.41% <2.46%> (-0.01%) ⬇️
pcap 44.22% <54.32%> (+0.03%) ⬆️
suricata-verify 63.51% <54.32%> (-0.02%) ⬇️
unittests 58.20% <9.87%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

WARNING:

field baseline test %
SURI_TLPR1_stats_chk
.uptime 637 614 96.39%

Pipeline 24952

To accompany the Exception Policy stats, also add information about any
Exception Policy triggered and for which target to the flow log event.

Task OISF#6215
ExceptionPolicy-related members added to the struct led to the need to
better optimize it.

Related to
Task OISF#6215
The stats for exception policies are only logged/ present when any of
the exception policies are enabled (which means any value other than
"auto" or "ignore" in IDS mode, or "ignore" in IPS mode).

This wasn't clearly stated in the docs.
@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24959

@jufajardini
Copy link
Contributor Author

an alternative output proposal:

{
  "pkts_toserver": 18,
  "pkts_toclient": 14,
  "bytes_toserver": 2146,
  "bytes_toclient": 7452,
  "start": "2019-05-15T08:11:18.738996+0000",
  "end": "2019-05-15T08:11:19.256052+0000",
  "age": 1,
  "state": "closed",
  "reason": "shutdown",
  "alerted": false,
  "exception_policy": {
     "triggered": [
        {
           "target": "stream_reassembly_memcap",
           "policy": "pass_packet"
        },
        {
           "target": "app_layer_error",
           "policy": "ignore"
        }
     ]
  }
}

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

Successfully merging this pull request may close these issues.

2 participants