-
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
loki_out: add stuctured_metadata_map_keys #9530
base: master
Are you sure you want to change the base?
loki_out: add stuctured_metadata_map_keys #9530
Conversation
7f1db76
to
a9cdcad
Compare
a9cdcad
to
e9fee7d
Compare
@0x006EA1E5 would you please add a JSON example that shows the before the option is set and the after so we can review the behavior intended to be implemented ? thank you |
Hey @edsiper, what kind of JSON do you need? This only touches the Loki output, so I could include:
Would this be okay? |
The below is the results for running this with {
"message": "simple log generated",
"logger": "my.logger",
"level": "INFO",
"hostname": "localhost",
"my_map_of_attributes_1": {
"key_1": "hello, world!",
"key_2": "goodbye, world!"
},
"my_map_of_maps_1": {
"root_key": {
"sub_key_1": "hello, world!",
"sub_key_2": "goodbye, world!"
}
}
} I used the following to query Loki: This is the output with the option enabled. As you can see, the [
{
"stream": {
"hostname": "localhost",
"key_1": "hello, world!",
"key_2": "goodbye, world!",
"level": "INFO",
"logger": "my.logger",
"service_name": "test",
"sub_key_1": "hello, world!",
"sub_key_2": "goodbye, world!"
},
"values": [
[
"1740489069234881956",
"simple log generated"
]
]
}
] And here is the output with the feature not enabled. This also removes [
{
"stream": {
"hostname": "localhost",
"level": "INFO",
"logger": "my.logger",
"service_name": "test"
},
"values": [
[
"1740489174234932650",
"message=\"simple log generated\" my_map_of_attributes_1=\"map[key_1:\"hello, world!\" key_2:\"goodbye, world!\"]\" my_map_of_maps_1=\"map[root_key:\"map[sub_key_1:\"hello, world!\" sub_key_2:\"goodbye, world!\"]\"]\""
]
]
}
] |
84faf4c
to
717081e
Compare
* Adds stuctured_metadata_map_keys config to dynamically populate stuctured_metadata from a map * Add docker-compose to test loki backend Signed-off-by: Greg Eales <[email protected]>
Signed-off-by: Greg Eales <[email protected]>
717081e
to
2ebd4ce
Compare
Ignore the container failures - it is a permissions problem I think for forks, they build ok but fail to push. |
Build and pushed manually: ghcr.io/fluent/fluent-bit:pr-9530 docker buildx build -t ghcr.io/fluent/fluent-bit:pr-9530 --platform=linux/amd64 --target=production --push=true . |
This image is now available for us, and my testing confirms it is working as expected 👍 |
Resolves #9463
The below is the results for running this with
/docker_compose/loki-grafana-structured_metadata_map/
, which has inputI used the following to query Loki:
curl http://localhost:3100/loki/api/v1/query_range --data-urlencode 'query={service_name="test"}' --data-urlencode 'limit=1' --data-urlencode 'step=5' | jq '.data.result'
This is the output with the option enabled. As you can see, the
stream
section contains the keys for the structured metadata:And here is the output with the feature not enabled. This also removes
my_map_of_attributes_1
andmy_map_of_maps_1
fromremove_keys. As you can see,
key_1,
key_2,
sub_key_1and
sub_key_2are no longer in the
stream` section: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-test
label to test for all targets (requires maintainer to do).Documentation
fluent/fluent-bit-docs#1527
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.