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

[receiver/syslog] expose the syslog parser config from the syslog receiver #36906

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

Conversation

namco1992
Copy link
Contributor

Description

The syslog receiver relies on the stanza syslog input. Among other inputs, the syslog input is a bit special because it's a wrapper of a TCP/UDP input with a syslog parser. The user can't configure the syslog parser because it's not exposed from the syslog input config, which means that some useful features like the on_error mode or parse_from/to is unavailable if you are using syslog receiver.

This PR adds the parser config to the syslog input config under the parser field. I chose not to flatten it because the existing InputConfig.WriterConfig will conflict with the ParserConfig.TransformerConfig.WriterConfig. We can override it later in the Build func, but I guess it's a bit implicit and error-prone, so I choose to add a new parser field. I'm open to changing it if the owners think otherwise.

This change should be backward-compatible.

Testing

Tested locally with newly added config.

Documentation

Added the parser config documentation to the syslog receiver README.

…eiver

The syslog receiver relies on the stanza syslog input. Among other
inputs, the syslog input is a bit special because it's a wrapper of a
TCP/UDP input with a syslog parser. The user can't configure the syslog
parser because it's not exposed from the syslog input config, which
means that some useful features like the `on_error` mode or
`parse_from/to` is unavailable if you are using syslog receiver.

This PR adds the parser config to the syslog input config, under
`parser` field. I choose not to flatten it because the existing
`InputConfig.WriterConfig` will be conflicted with the
`ParserConfig.TransformerConfig.WriterConfig`. We can overrides it later
in the `Build` func, but I guess it's a bit implicit and error-prone,
therefore I choose to add a new `parser` field. I'm open to change it if
the owners think otherwise.

This change should be backward-compatible.
@namco1992
Copy link
Contributor Author

https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/12425577954/job/34692561655?pr=36906
It seems the TestComponentConfigStruct is unhappy with the ParserConfig. I indeed didn't find another example that exposes the ParserConfig on the receiver level, is it a controversial thing to do? Would appreciate any guidance on this.

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

I don't agree that there's any reason to expose most of these settings. The only one that makes any sense to me is on_error because it can provide useful behavior options.

All of the other fields suggested here are for things that instruct the parser where to find things, which is already defined due to the behavior of the tcp and udp inputs.

If you want to customize behavior further, why not use tcp or udp receivers and configure the syslog parser manually?

@namco1992
Copy link
Contributor Author

Hi @djaglowski, thanks for the reply.

The only one that makes any sense to me is on_error because it can provide useful behavior options.

If this makes some sense, then is it possible to at least expose this config?

All of the other fields suggested here are for things that instruct the parser where to find things, which is already defined due to the behavior of the tcp and udp inputs.

Can you elaborate more on this point? The TCP/UDP inputs didn't really "define" any parser config other than init a default config. I'm also not sure why it would be a bad thing to grant users the power to config the parser.

If you want to customize behavior further, why not use tcp or udp receivers and configure the syslog parser manually?

Yes, I guess we would have to go down that route if this can't happen upstream. However, there is some config that we can't touch from the outside, like setting the SplitFuncBuilder to OctetSplitFuncBuilder:

if syslogParserCfg.EnableOctetCounting {
tcpInputCfg.SplitFuncBuilder = OctetSplitFuncBuilder
}

CMIIW, but it seems we can't really have a 1-1 replication of the syslog receiver by combining TCP/UDP receiver with syslog parser.

Lastly, the syslog_input documentation claims that it supports https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/f21f7183cafdb2ec61fbb23692e9ee37b4f871c2/pkg/stanza/docs/operators/syslog_parser.md#configuration-fields, but that's not true since the parser config is not configurable.

| `syslog` | required | A [syslog parser config](./syslog_parser.md#configuration-fields) to defined syslog_parser operator. |

I understand that it might be a niche request, but I believe it's a reasonable one(or probably because I needed it 🙊 ). I'm ok with exposing the ones that you think make sense.

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.

3 participants