Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Add labels to k8s_metadata #83

Merged
merged 2 commits into from
Oct 4, 2018

Conversation

suversky
Copy link
Contributor

Purpose

This PR allows users to specify labels as format strings, e.g.:

SOURCE_NAME="%{label:app}:%{label:version}"

Technical details

  • kubernetes[:labels][:foo] is flattened to k8s_metadata[:"label:foo"] because the % format operator does not allow nested hash lookup - i.e. there is no way to do the following:
%{foo[:bar]} % {foo: {bar: "baz"}}
  • k8s_metadata sets a default undefined value because unlike namespace, pod, container and source_host, labels are not guaranteed to exist. In the SOURCE_NAME example above, if we have an app: foo label but no version label, then we will get foo:undefined as a source name instead of the more mysterious foo:.

@frankreno
Copy link
Contributor

@suversky this is a great add, love it. Can you please add some details to the readme on this? Having a dedicated section at the bottom that explains this is fine by me but lets add that as well.

@frankreno
Copy link
Contributor

LGTM, thanks!

@frankreno frankreno merged commit 7be79b4 into SumoLogic:master Oct 4, 2018
@frankreno
Copy link
Contributor

I will cut a new release in a few days after I work thru the current open issues and address any issues there, will update here once I do.

frankreno added a commit that referenced this pull request Oct 5, 2018
- [Add labels to k8s_metadata](#83)
- [Add source_host to conf.d/systemd/source.containers.conf](#84)
- minor refactoring and testing
- upgrade fluent-plugin-sumologic_output to latest (1.3.1)
- expose additional configuration options to provide more control over fluent-plugin-kubernetes_metadata_filter using default values (fixes #80 and #35)
@frankreno
Copy link
Contributor

@suversky v1.2.0 and latest will contain these changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants