Skip to content

feat: capture events filesize limits#3824

Merged
poiana merged 2 commits intomasterfrom
feat/capture-events-filesize-limits
Apr 29, 2026
Merged

feat: capture events filesize limits#3824
poiana merged 2 commits intomasterfrom
feat/capture-events-filesize-limits

Conversation

@leogr
Copy link
Copy Markdown
Member

@leogr leogr commented Mar 17, 2026

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

/kind release

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area tests

/area proposals

/area CI

What this PR does / why we need it:

This adds capture_events and capture_filesize (kB) as new stop conditions for capture files, both as per-rule fields and as global config defaults (default_events, default_filesize). When multiple conditions are configured alongside the existing capture_duration, the first one that is met stops the capture (OR semantics).

Also fixes:

  • pre-existing gaps in the rule Override JSON schema
  • and adds comprehensive unit tests for all capture-related fields.

Which issue(s) this PR fixes:

Fixes #3764

Special notes for your reviewer:

/milestone 0.44.0

cc @geraldcombs

Does this PR introduce a user-facing change?:

new(config,rules): add `capture_events` and `capture_filesize` stop conditions for capture files

ekoops
ekoops previously approved these changes Mar 17, 2026
Copy link
Copy Markdown
Contributor

@ekoops ekoops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd replace filesize with file_size everywhere, but I'm gonna approve it. Feel free to change or mantain it as is.
/approve

@leogr
Copy link
Copy Markdown
Member Author

leogr commented Mar 17, 2026

I'd replace filesize with file_size everywhere, but I'm gonna approve it. Feel free to change or mantain it as is. /approve

good point. Just
/hold

to collect some more feedback about this

Comment thread falco.yaml Outdated
# in milliseconds.
# in milliseconds. Optionally, set `capture.default_events` to limit the
# number of captured events, and `capture.default_filesize` to limit the
# capture file size in kB.
Copy link
Copy Markdown
Contributor

@geraldcombs geraldcombs Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "kiB"? There was a big push to use IEC units for base 2 prefixes years ago, but I'm not sure where best practices stand nowadays.

This looks great otherwise!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 🤔

I checked, and the Falco project consistently uses SI-style unit names everywhere (e.g., rollover_mb in sinsp_cycledumper, convert_memory_to_mb, and kb for RSS/PSS/VSZ in Falco metrics). There are no IEC units (kiB, MiB) used anywhere in either falco or libs.

I believe sticking with kB here is the right call for consistency with the rest of the codebase, even though technically the code multiplies by 1024.

Likely, it is worth keeping a note for a full review of Falco with respect to the units convention.

Thanks for the review! 🙏

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the documentation for these configuration variables use SI units?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there's no documentation. It's just the convention of the current implementation.

@leogr
Copy link
Copy Markdown
Member Author

leogr commented Apr 10, 2026

/hold cancel

@leogr leogr force-pushed the feat/capture-events-filesize-limits branch from e41c2de to c089007 Compare April 14, 2026 09:42
@github-actions
Copy link
Copy Markdown

This PR may bring feature or behavior changes in the Falco engine and may require the engine version to be bumped.

Please double check userspace/engine/falco_engine_version.h file. See versioning for FALCO_ENGINE_VERSION.

/hold

@leogr leogr force-pushed the feat/capture-events-filesize-limits branch from c089007 to 495f943 Compare April 14, 2026 10:23
@leogr
Copy link
Copy Markdown
Member Author

leogr commented Apr 14, 2026

/remove-hold

ekoops
ekoops previously approved these changes Apr 14, 2026
Comment thread falco.yaml Outdated
@leogr leogr force-pushed the feat/capture-events-filesize-limits branch from 495f943 to 3e06d1e Compare April 20, 2026 09:41
@leogr
Copy link
Copy Markdown
Member Author

leogr commented Apr 24, 2026

@irozzo-1A @ekoops @geraldcombs PTAL again 🙏

Comment thread userspace/falco/app/actions/process_events.cpp Outdated
@leogr leogr force-pushed the feat/capture-events-filesize-limits branch from 3e06d1e to 723d8e5 Compare April 27, 2026 10:35
leogr and others added 2 commits April 27, 2026 13:20
Co-authored-by: Alessandro Cannarella <cannarella.dev@gmail.com>
Co-authored-by: Gerald Combs <gerald@wireshark.org>
Co-authored-by: Iacopo Rozzo <iacopo@sysdig.com>
Co-authored-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
@leogr leogr force-pushed the feat/capture-events-filesize-limits branch from 723d8e5 to 6d3cb8c Compare April 27, 2026 11:23
Copy link
Copy Markdown
Contributor

@geraldcombs geraldcombs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, and I think making the file size a hard limit makes sense.

ASSERT_VALIDATION_STATUS(yaml_helper::validation_ok) << m_load_result->schema_validation();

auto rule_description = m_engine->describe_rule(&rule_name, {});
ASSERT_EQ(rule_description["rules"][0]["info"]["capture"].template get<bool>(), true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an assertion for the default duration here?

Copy link
Copy Markdown
Contributor

@irozzo-1A irozzo-1A left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@github-project-automation github-project-automation Bot moved this from Todo to In progress in Falco Roadmap Apr 29, 2026
@poiana
Copy link
Copy Markdown
Contributor

poiana commented Apr 29, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ekoops, geraldcombs, irozzo-1A, leogr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 9b72af5 into master Apr 29, 2026
32 checks passed
@poiana poiana deleted the feat/capture-events-filesize-limits branch April 29, 2026 08:27
@github-project-automation github-project-automation Bot moved this from In progress to Done in Falco Roadmap Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add more criteria for capture file deadlines

5 participants