Skip to content

Conversation

@Caleb-Hurshman
Copy link
Collaborator

Description

Refactor the IIS receiver logging to be sub-agent agnostic.
I am considering this a "rough draft". I believe the Lua functionality has been preserved. IIS is Windows-only, but the RegisterLoggingFilesProcessorMacro function doesn't handle a platform argument yet.

Related issue

How has this been tested?

Updated transformation_test and confgenerator_test, confirmed the output of output_fluentbit.yaml was unchanged after refactoring the receiver.

Checklist:

  • Unit tests
    • Unit tests do not apply.
    • Unit tests have been added/modified and passed for this PR.
  • Integration tests
    • Integration tests do not apply.
    • Integration tests have been added/modified and passed for this PR.
  • Documentation
    • This PR introduces no user visible changes.
    • This PR introduces user visible changes and the corresponding documentation change has been made.
  • Minor version bump
    • This PR introduces no new features.
    • This PR introduces new features, and there is a separate PR to bump the minor version since the last release already.
    • This PR bumps the version.

Copy link
Contributor

@franciscovalentecastro franciscovalentecastro left a comment

Choose a reason for hiding this comment

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

@Caleb-Hurshman This is a good "rough draft". It really brings to light all the technical considerations around refactoring IIS. I added some comments. Thank you for the effort in this so far!

Copy link
Contributor

Choose a reason for hiding this comment

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

After further thought, i think we shouldn't add CustomLuaFunc / CustomOTTLFunc to ModifyFields. Some reasons for this :

  • ModifyFields current abstraction is to work with the fields <dest> , <source>, but this new features extend this to an arbitrary list of fields.
  • ModifyFields is also a feature exposed to users.
  • This is required by only the IIS processor so adding complexity here is unnecessary for only one case.
  • The only required operation missing from ModifyFields is string concatenation. Using CustomConvertFunc + Concat 1 we can do this in Otel.
  • For fluent-bit we can keep a similar Lua script for the string concatenation and simplify the steps that can be done with ModifyFields (e.g. ommiting fields).

Please remove CustomLuaFunc / CustomOTTLFunc and do the following instead :

  • Create an InternalLoggingProcessor (interface) called IISConcatFields which implements the methods Components (fluent-bit) and Processors (otel).
  • Use ModifyFields + CustomConvertFunc + Concat 1 for the Otel implementation. CustomConvertFunc can access any field in the log.
  • Use LuaFilterComponents for fluent-bit implementation of concatenation.
  • Simplify/remove the existing LuaScripts if possible.

Let me know if this is possible or if there any specific limitations.

Footnotes

  1. https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/ottlfuncs/README.md#concat 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@franciscovalentecastro Most of this sounds good, but the otel output has not been working properly after changing to Processors:
- config_error: "processor \"processor0\" has invalid configuration: unimplemented"

I believe there might be a mismatch with the processor interface in OTel, let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the reason of that failure is that the signature of the Processors method should return ([]otel.Component, error) :

}
type InternalOTelProcessor interface {
Processors(context.Context) ([]otel.Component, error)
}

For this particular implementation it seems you would be able to call the Processors method of the modifyFields processor defined within the IISConcatFields.Processors method and "return" the result.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did try the return that way, but encountered the same result. I'll change the return type back, but there's more to this issue. I'll dig in further once the rest of the receivers are up to date.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, you are right, there is more to this issue. This is a bug i've encountered before, but failed to fix in other PR's. I can fix this in a separate PR or we can do it here. Let me know what do you think its best.

[Optional]

In logging_macros.go, all the Pipelines () / Processors() methods should use InternalOtelReceiver / InternalOtelProcessor instead of OtelReceiver / OtelProcessor. This should fix the unimplemented error.

receiver, processors := cr.Expand(ctx)
if r, ok := any(receiver).(OTelReceiver); ok {
rps, err := r.Pipelines(ctx)

for _, p := range processors {
if p, ok := p.(OTelProcessor); ok {
c, err := p.Processors(ctx)

for _, lp := range cp.Expand(ctx) {
if p, ok := any(lp).(OTelProcessor); ok {
c, err := p.Processors(ctx)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm glad to hear you know what the issue is! I think a separate PR would be good since a lot is going on in this PR already.

@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 28, 2025
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.

2 participants