Skip to content

affile: add exclude-pattern() option to wildcard-file()#5416

Merged
HofiOne merged 2 commits intosyslog-ng:developfrom
overhacked:overhacked/wildcard-exclusion
Jul 16, 2025
Merged

affile: add exclude-pattern() option to wildcard-file()#5416
HofiOne merged 2 commits intosyslog-ng:developfrom
overhacked:overhacked/wildcard-exclusion

Conversation

@overhacked
Copy link
Contributor

Add ability to refine wildcard-file( filename-pattern() ) option with exclude-pattern() to exclude some matching files. Example: match all *.log but exclude *.?.log.

A new option for the wildcard-file source is added and a new functional test that ensures exclude-pattern() works is included in tests/functional. The new test is a separate test file, because exclude-pattern doesn't need to be tested with the same poll/auto configuration variants that the rest of the affile tests need to be exercised with.

The implementation is just a new option in the module's config parser and one new logic test in modules/affile/wildcard-source.c:_handle_file_created().

@kira-syslogng
Copy link
Contributor

Can one of the admins verify this patch?

1 similar comment
@kira-syslogng
Copy link
Contributor

Can one of the admins verify this patch?

@overhacked overhacked force-pushed the overhacked/wildcard-exclusion branch from e786a29 to 14ebec0 Compare July 14, 2025 18:32
@HofiOne
Copy link
Collaborator

HofiOne commented Jul 15, 2025

@overhacked Thank you for your contribution. I will check it soon.

@github-actions
Copy link
Contributor

This Pull Request introduces config grammar changes

syslog-ng/86cd95766159aa14b20569f55b78f72012da7b49 -> overhacked/overhacked/wildcard-exclusion

Details
--- a/source
+++ b/source

 wildcard-file(
+    exclude-pattern(<string>)
 )

Copy link
Collaborator

@HofiOne HofiOne left a comment

Choose a reason for hiding this comment

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

@overhacked Apart from the 2 tiny style-check issues, it LGTM, nice job, thank you!

NOTE: You can ignore the FreeBSD error; it is (hopefully temporarily)a problem in the current state of the v15 ports.

static gboolean
_init_exclude_pattern(WildcardSourceDriver *self)
{
if (self->exclude_pattern) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Style check fails on this, please correct

Screenshot 2025-07-15 at 8 44 34

Add ability to refine wildcard-file( filename-pattern() ) option with
exclude-pattern() to exclude some matching files. Example:
match all *.log but exclude *.?.log.

Signed-off-by: Ross Williams <[email protected]>
Signed-off-by: Ross Williams <[email protected]>
@overhacked overhacked force-pushed the overhacked/wildcard-exclusion branch from 14ebec0 to fb9fdf5 Compare July 15, 2025 18:33
@overhacked
Copy link
Contributor Author

@HofiOne I fixed and rebased with the style corrections, but CI didn't seem to automatically re-run. Also, I did run make style-check before opening the PR, and it didn't flag the issues. Did I miss something?

Copy link
Collaborator

@HofiOne HofiOne left a comment

Choose a reason for hiding this comment

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

Thank you.

@HofiOne HofiOne merged commit 0958179 into syslog-ng:develop Jul 16, 2025
30 of 31 checks passed
HofiOne added a commit to syslog-ng/syslog-ng.github.io that referenced this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants