-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Feature Request: Customize swarmStackLabelName and swarmServiceLabelName values #1931
Comments
Definitively a fair request. I'm thinking about this. I'm considering relabelling but the config is complex to go into log option Using a file has been a nightmare for pipeline stages, so I'm reluctant to that. Would base 64 encode the config ?
?? |
I like the use of the
|
I don't know if that example would not explode because of yaml inside quote, this is why I was suggesting base 64. |
I'm pretty sure that works, because I have Docker services configured that way with big blocks of TOML or YAML passed in via environment variables. If I have some time later this week, I'll try passing something like that into the loki-docker-driver plugin and see what happens. |
Alright let's build a POC and you let me know. I'll build an image for you. |
Here is the commit: cyriltovena@2de9596 You can try using this plugin: the log option name is Here is an example rewriting Let me know if it works and I'll add the doc and send a PR if this solves your problem. Or you can even take over my branch if you want to send the PR with the doc update :) |
How was it ? @kinghuang any feedback ? If that works for you I'll send a PR. |
@CyrilPeponnet Sorry, my bad on the huge delay. I'll schedule some time to test this out next week. |
That works perfectly! I created a new swarm cluster with As YAML:
Rendered config in daemon.json:
Logs arrived in Loki with
Sorry again for the huge delay in testing this! |
Nice I'll finish this PR soon enough so that it hits master ! |
Is your feature request related to a problem? Please describe.
The Loki docker-driver has hard-coded labels for Docker Swarm stack and services as
swarm_stack
andswarm_service
, respectively (config.go#L47). I would like to be able to customize these labels tonamespace
andservice
, to match corresponding metrics in Prometheus.Describe the solution you'd like
Provide a way to customize the label name values for
swarmServiceLabelName
andswarmStackLabelName
.Describe alternatives you've considered
Not sure if there's an equivalent to Prometheus' metric_relabel_configs in Loki.
Additional context
Similar hard-coded labels for Docker Compose projects were added in #970.
The text was updated successfully, but these errors were encountered: