-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
out_gelf: test: Implement injecting tag capability #9031
Conversation
9d680c5
to
a494870
Compare
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
a494870
to
55f0bca
Compare
plugins/out_gelf/gelf.c
Outdated
msgpack_sbuffer_destroy(&sbuf); | ||
return -1; | ||
} | ||
memcpy(*out_buf, sbuf.data, sbuf.size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is possible to avoid the memory copy by simply assigning the pointer to the msgpack buffer, e.g:
*out_buf = sbuf.data
*out_size = sbuf.size
just do not destroy sbuf before returning and should be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it. Direct operation should be fine if avoiding memory copy:
static inline void msgpack_sbuffer_init(msgpack_sbuffer* sbuf)
{
memset(sbuf, 0, sizeof(msgpack_sbuffer));
}
static inline void msgpack_sbuffer_destroy(msgpack_sbuffer* sbuf)
{
free(sbuf->data);
}
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
plugins/out_gelf/gelf.c
Outdated
msgpack_pack_object(&pck, map->via.map.ptr[i].val); | ||
} | ||
|
||
for (i = 0; i < 1; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the for
loop ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I unrolled a needless loop.
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
To align the behavior of Fluentd side of gelf plugin, we need to implement a capability to inject tag information to gelf records if available.
Closes #8921
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Without Tag
$ bin/fluent-bit -i dummy -pdummy='{"message":"dummy","send":"from fluent-bit"}' -o gelf -p port=12202 -pgelf_short_message_key=message -v
With Tag
Without Tag
With Tag
Without Tag
With Tag
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
fluent/fluent-bit-docs#1403
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.