-
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_cloudwatch_logs: support record_accessor #5633
Conversation
98fc515
to
d745985
Compare
So this feature uses record accessor to template CW log stream and group names: https://docs.fluentbit.io/manual/v/1.5/administration/configuring-fluent-bit/record-accessor This is a higher perf version of the golang feature: https://github.com/aws/amazon-cloudwatch-logs-for-fluent-bit#templating-log-group-and-stream-names It is not exactly the same feature however, since record accessor has a different syntax and works differently. We have two new config items:
The existing log group and stream config options are used as fallbacks. Here's an example config:
And here is my logger script which creates fake logs that have fake k8s metadata for use with the template:
|
b216493
to
c8e150f
Compare
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.
@PettitWesley I reviewed flb_record_accessor.[ch].
Could you add a test code to tests/internal/record_accessor.c
?
src/flb_record_accessor.c
Outdated
int check = FLB_FALSE; | ||
|
||
return flb_ra_translate_check(ra, tag, tag_len, map, result, check); |
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.
How about not using check variable like return flb_ra_translate_check(ra, tag, tag_len, map, result, FLB_FALSE);
?
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.
fixed
src/flb_record_accessor.c
Outdated
* For safety, the function returns a newly created string that needs | ||
* to be destroyed by the caller. | ||
* | ||
* Returns NULL if `check` is FLB_TRUE and any key loopup in the record failed |
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.
Is loopup
a typo ?
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.
yeah oops... thanks
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.
fixed
|
9729515
to
03fcbb2
Compare
@edsiper fixed now |
@nokute78 I added a unit test for |
…en keys are not found Signed-off-by: Wesley Pettit <wppttt@amazon.com>
…m and group names Signed-off-by: Wesley Pettit <wppttt@amazon.com>
Signed-off-by: Wesley Pettit <wppttt@amazon.com>
03fcbb2
to
158e99e
Compare
NOTE: CI was failing due upstream tests, that test has been reverted. |
#3246
Doc PR: fluent/fluent-bit-docs#834
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:
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.