-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Mapping error with Docker Swarm labels #6421
Comments
Merged
exekias
pushed a commit
to exekias/beats
that referenced
this issue
Feb 25, 2018
This method implements a way to put dotted keys into a MapStr while ensuring they don't override each other. For example: ``` a := MapStr{} a.Put("com.docker.swarm.task", "x") a.Put("com.docker.swarm.task.id", 1) a.Put("com.docker.swarm.task.name", "foobar") ``` Will result in `{"com":{"docker":{"swarm":{"task":"x"}}}}` DeDotPut detects this scenario and renames the common base key, by appending `.value`: ``` a := MapStr{} safemapstr.Put(a, "com.docker.swarm.task", "x") safemapstr.Put(a, "com.docker.swarm.task.id", 1) safemapstr.Put(a, "com.docker.swarm.task.name", "foobar") ``` Will result in `{"com":{"docker":{"swarm":{"task":{"id":1,"name":"foobar","value":"x"}}}}}` The plan is to use this method to convert all unstructured external data, like labels, annotations and so Related to elastic#6421
andrewkroh
pushed a commit
that referenced
this issue
Mar 12, 2018
* Add `safemapstr` to provide `Put`: This method implements a way to put dotted keys into a MapStr while ensuring they don't override each other. For example: ``` a := MapStr{} a.Put("com.docker.swarm.task", "x") a.Put("com.docker.swarm.task.id", 1) a.Put("com.docker.swarm.task.name", "foobar") ``` Will result in `{"com":{"docker":{"swarm":{"task":"x"}}}}` DeDotPut detects this scenario and renames the common base key, by appending `.value`: ``` a := MapStr{} safemapstr.Put(a, "com.docker.swarm.task", "x") safemapstr.Put(a, "com.docker.swarm.task.id", 1) safemapstr.Put(a, "com.docker.swarm.task.name", "foobar") ``` Will result in `{"com":{"docker":{"swarm":{"task":{"id":1,"name":"foobar","value":"x"}}}}}` The plan is to use this method to convert all unstructured external data, like labels, annotations and so Related to #6421 * Apply some review comments * Use tryToMapStr when checking leaf node
This was fixed by #6434 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both when using
add_docker_metadata
and Docker autodiscover provider with Docker Swarm, in some cases we see mapping issues due to this labels set:We should offer a way to "dedot" label names, or have an alternative way to detect the situation and avoid mapping errors.
Reference in discuss: https://discuss.elastic.co/t/using-autodiscover-feature-for-docker-does-not-work-when-running-in-swarm-mode/120342
Current workaround is to use
drop_field
processor like this:The text was updated successfully, but these errors were encountered: