Skip to content

fix(gelf encoder): gelf encoder error message #23021

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mprasil
Copy link

@mprasil mprasil commented May 9, 2025

Summary

The error message in case the field name contains incorrect characters is misleading and can cause quite an confusion.

The issue can be reproduced with following Vector config:

sources:
  test:
    type: demo_logs
    format: shuffle
    decoding:
      codec: json
    count: 1
    lines:
      - '{"foo:baz": "baz", "short_message": "x"}'
sinks:
  console:
    type: console
    encoding:
      codec: gelf
    inputs:
      - test

With current version of vector I got:

❯ vector -c /tmp/vector.yaml -q
2025-05-09T19:55:47.827681Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::internal_events::codecs: Failed serializing frame. error=LogEvent does not contain required field: "foo:baz" error_code="encoder_serialize" error_type="encoder_failed" stage="sending" internal_log_rate_limit=true
2025-05-09T19:55:47.827769Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector_common::internal_event::component_events_dropped: Events dropped intentional=false count=1 reason="Failed serializing frame." internal_log_rate_limit=true
2025-05-09T19:55:47.827800Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::topology: An error occurred that Vector couldn't handle: the task completed with an error.

The part where it says LogEvent does not contain required field: "foo:baz" is quite confusing, because the field is there and it's certainly not required. (though that might not be obvious for less unusual field name)

It looks like the error message was there since early gelf implementation and not really intentional. (possibly a placeholder that was never replaced)

The fixed version generates pretty straightforward message:

❯ vector -c /tmp/vector.yaml -q
2025-05-09T20:22:13.387678Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::internal_events::codecs: Failed serializing frame. error=LogEvent contains field with invalid character in name: "foo:baz" error_code="encoder_serialize" error_type="encoder_failed" stage="sending" internal_log_rate_limit=true
2025-05-09T20:22:13.388008Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector_common::internal_event::component_events_dropped: Events dropped intentional=false count=1 reason="Failed serializing frame." internal_log_rate_limit=true
2025-05-09T20:22:13.388544Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::topology: An error occurred that Vector couldn't handle: the task completed with an error.

This should hopefully be much easier to troubleshoot.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

I've tested it with above configuration.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

The error message in case the field name contains incorrect characters is misleading and can cause
quite an confusion.

The issue can be reproduced with following Vector config:

```yaml
sources:
  test:
    type: demo_logs
    format: shuffle
    decoding:
      codec: json
    count: 1
    lines:
      - '{"foo:baz": "baz", "short_message": "x"}'
sinks:
  console:
    type: console
    encoding:
      codec: gelf
    inputs:
      - test
```

With current version of vector I got:

```sh
❯ vector -c /tmp/vector.yaml -q
2025-05-09T19:55:47.827681Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::internal_events::codecs: Failed serializing frame. error=LogEvent does not contain required field: "foo:baz" error_code="encoder_serialize" error_type="encoder_failed" stage="sending" internal_log_rate_limit=true
2025-05-09T19:55:47.827769Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector_common::internal_event::component_events_dropped: Events dropped intentional=false count=1 reason="Failed serializing frame." internal_log_rate_limit=true
2025-05-09T19:55:47.827800Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::topology: An error occurred that Vector couldn't handle: the task completed with an error.
```

The part where it says `LogEvent does not contain required field: "foo:baz"` is quite confusing,
because the field is there and it's certainly not required. (though that might not be obvious for
less unusual field name)

It looks like the error message was there since early gelf implementation and not really
intentional. (possibly a placeholder that was never replaced)

The fixed version generates pretty straightforward message:

```
❯ vector -c /tmp/vector.yaml -q
2025-05-09T20:22:13.387678Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::internal_events::codecs: Failed serializing frame. error=LogEvent contains field with invalid character in name: "foo:baz" error_code="encoder_serialize" error_type="encoder_failed" stage="sending" internal_log_rate_limit=true
2025-05-09T20:22:13.388008Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector_common::internal_event::component_events_dropped: Events dropped intentional=false count=1 reason="Failed serializing frame." internal_log_rate_limit=true
2025-05-09T20:22:13.388544Z ERROR sink{component_kind="sink" component_id=console component_type=console}: vector::topology: An error occurred that Vector couldn't handle: the task completed with an error.
```

This should hopefully be much easier to troubleshoot.
@mprasil mprasil requested a review from a team as a code owner May 9, 2025 20:56
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.

1 participant