-
Notifications
You must be signed in to change notification settings - Fork 1.8k
in_systemd: add 'lowercase' option #4908
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
Conversation
ConfigLogValgrind output |
plugins/in_systemd/systemd.c
Outdated
| msgpack_pack_str_body(&mp_pck, key, len); | ||
|
|
||
| if (ctx->lowercase == FLB_TRUE) { | ||
| tmp = flb_sds_create_len(key, len); |
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 was wondering if we could re-use the original systemd buffer (pointed by key) to perform the lowercase conversion, can you check it ?
if the previous step is not possible, we might use a pre-allocated buffer for key conversion to avoid a tons of malloc/free on each record iteration. I see in the docs that usually records gets truncated at 64kb:
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.
Thank you for taking the time to review this pull request!
I've seen the manpage saying that ”returned data is in a read-only memory map” so chose not to overwritten the data directly; however, I see your point, so how about pre-allocating a buffer whose size is equal to the threshold from sd_journal_get_data_threshold() and increase it when it’s insufficient to hold the entire key? I’ve pushed the branch trying to reflect this.
This threshold is a hint only: it indicates that the client program is interested only in the initial parts of the data fields, up to the threshold in size — but the library might still return larger data objects. That means applications should not rely exclusively on this setting to limit the size of the data fields returned, but need to apply an explicit size limit on the returned data as well.
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.
that looks pretty good :) , thank you!
549e4ad to
4c0d4aa
Compare
|
ah, pls rebase on top of GIT master to fix the conflicts so we can merge it |
Signed-off-by: Chitoku <odango@chitoku.jp>
Signed-off-by: Chitoku <odango@chitoku.jp>
4c0d4aa to
5e835b6
Compare
|
@edsiper |
|
thank you!, it will be part of next release next week. would you please submit a PR for the docs too ? (cc: @lecaros) |
|
The PR for the docs is here: fluent/fluent-bit-docs#724 |
* in_systemd: add 'lowercase' option Signed-off-by: Chitoku <odango@chitoku.jp> Signed-off-by: Manal Geries <mgeriesa@gmail.com>
This patch adds support of lowercase option for the systemd input plugin. The name of option is aligned to
https://github.com/fluent-plugin-systemd/fluent-plugin-systemd.
Addresses #1543
Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
Documentation
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.