-
Notifications
You must be signed in to change notification settings - Fork 1.8k
in_systemd: allow a parser to be specified as part of the systemd unit #9567
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
base: master
Are you sure you want to change the base?
Conversation
21c2e24 to
c94ed77
Compare
|
Example config: The systemd unit of the service whose logs we now parse: Log output showing that |
c94ed77 to
e8a8138
Compare
|
Valgrind is happy: |
e8a8138 to
07962d7
Compare
|
@seveas I am trying to understand the use case here. Can you expand a bit on what is the problem you are trying to solve? |
07962d7 to
c23b26c
Compare
|
@niedbalski the trigger for this is the desire to move to yaml based configs, and the incompatibility of those and the way we build our configuration. We currently have a base config (not yaml) deployed to all hosts, it includes a systemd input and a strategically placed This is impossible to do in yaml configs, as its inclusion system only supports including full pipelines. So, taking inspiration from the kubernetes filter, where you can have one input, one filter and using metadata attached to pods, we came up with this strategy where a systemd unit can specify a parser to use, removing the need for a separate filter per systemd service and removing the need for these includes. |
Similar to how we use kubernetes annotations to determine a parser, this uses custom fields in systemd units to configure a parser per systemd unit. In the unit file this is configured as: ``` [Service] ... LogExtraFields=FLUENT_BIT_PARSER=logfmt ``` Signed-off-by: Dennis Kaarsemaker <[email protected]>
c23b26c to
f139bc5
Compare
|
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
|
hi. Can you elaborate on your use case?
|
|
@seveas can you address both the conflicts and questions asked by reviewers? |
This merge integrates the parser functionality from PR fluent#9567 with the current master branch's cfl_kvlist-based implementation. Changes: - Added flb_systemd_repack_map() function to repack parsed msgpack data - Added parser lookup from FLUENT_BIT_PARSER systemd journal field - Modified systemd_enumerate_data_store() to accept and apply parser - Parser is applied to MESSAGE field when specified - FLUENT_BIT_PARSER field is excluded from output - Parsed data is repacked and integrated into the log encoder The parser allows per-systemd-unit log parsing configuration via: [Service] LogExtraFields=FLUENT_BIT_PARSER=logfmt Co-authored-by: Dennis Kaarsemaker <[email protected]>
Similar to how we use kubernetes annotations to determine a parser, this
uses custom fields in systemd units to configure a parser per systemd
unit.
In the unit file this is configured as:
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.
ok-package-testlabel to test for all targets (requires maintainer to do).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.