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

fluent source with log_namespace puts all fields to namespace #20814

Open
jiping-s opened this issue Jul 8, 2024 · 1 comment
Open

fluent source with log_namespace puts all fields to namespace #20814

jiping-s opened this issue Jul 8, 2024 · 1 comment
Labels
source: fluent Anything `fluent` source related type: bug A code related bug.

Comments

@jiping-s
Copy link

jiping-s commented Jul 8, 2024

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

When the fluent source is used with log_namespace enabled, all fields are moved into that namespace, instead of only the source's additional fields. This behavior is inconsistent with http_server and other sources.

Configuration

sources:
    in_fluent:
        type: fluent
        address: 0.0.0.0:24224
        log_namespace: true
transforms:
  tf_mark_vector:
    type: remap
    inputs: [in_fluent]
    source: |
      .fluent = %fluent
sinks:
  out_stdout:
    type: console
    inputs: [tf_mark_vector]
    encoding:
      codec: json
      timestamp_format: rfc3339

Version

0.38.0

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

@jiping-s jiping-s added the type: bug A code related bug. label Jul 8, 2024
@jszwedko
Copy link
Member

jszwedko commented Jul 8, 2024

Thanks @jiping-s . I was able to reproduce this bug. The issue is that record shouldn't be inserted as metadata, but instead should be used as the object itself. I think the bug is around here:

for (key, value) in record.into_iter() {
let value: Value = value.into();
log_namespace.insert_source_metadata(
FluentConfig::NAME,
&mut log,
Some(LegacyKey::Overwrite(path!(key.as_str()))),
path!("record", key.as_str()),
value,
);

As a workaround until the bug is fixed you can do:

. = %record

@jszwedko jszwedko added the source: fluent Anything `fluent` source related label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source: fluent Anything `fluent` source related type: bug A code related bug.
Projects
None yet
Development

No branches or pull requests

2 participants