Skip to content

Conversation

@leodido
Copy link
Owner

@leodido leodido commented Jan 25, 2025

Fixes #21

This PR introduces breaking changes because it changes the Parser interface.
As a consequence, before merging it I'm waiting for confirmation it works in a real scenario from the grafana/alloy folks (see issue). Also, it would cause v5 to get released.

What it does

By merging in this PR,
the nontransparent and octetcounting parsers can now specify which options to pass down to the underlying syslog RFC machine parsers (RFC3164 vs RFC5424).

It introduces a syslog.ParserOption to let you do so: syslog.WithMachineOptions(opts ...syslog.MachineOption).

Example:

nontransparent.NewParserRFC3164(
  syslog.WithMachineOptions(rfc3164.WithYear(rfc3164.CurrentYear{})),
  syslog.WithListener(accumulator),
).Parse(r)

…) (delegating it to the underlying machine and their options)

Signed-off-by: Leonardo Di Donato <[email protected]>
@leodido leodido self-assigned this Jan 25, 2025
@leodido leodido changed the title feat!: ... feat!: better options Jan 25, 2025
@leodido leodido changed the title feat!: better options feat!: allow passing down machine options from nontransparent/octetcounting parsers Jan 25, 2025
@leodido leodido marked this pull request as ready for review January 25, 2025 18:46
@leodido
Copy link
Owner Author

leodido commented Jan 28, 2025

Friendly ping @dehaansa :)

@leodido leodido merged commit e1d78c2 into develop Feb 10, 2025
5 checks passed
@leodido leodido deleted the bc/revamp-options branch February 10, 2025 15:47
@leodido leodido added enhancement New feature or request breaking-change labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no ability to use MachineOptions (WithYear) with nontransparent/octetcounting parsers

2 participants