Skip to content

Commit

Permalink
Docker logging driver: Add a keymod for the extra attributes from the…
Browse files Browse the repository at this point in the history
… Docker logging driver (#2459)

* docker: add a keymod to replace . by _, making them "prometheus"-friendly

* docker: fix the code

* docker: replace also - by _
  • Loading branch information
RaitoBezarius authored Sep 17, 2020
1 parent 337db2f commit e9c9faf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/docker-driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ func parseConfig(logCtx logger.Info) (*config, error) {
}

// other labels coming from docker labels or env selected by user labels, labels-regex, env, env-regex config.
attrs, err := logCtx.ExtraAttributes(nil)
attrs, err := logCtx.ExtraAttributes(func(label string) string {
return strings.ReplaceAll(strings.ReplaceAll(label, "-", "_"), ".", "_")
})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e9c9faf

Please sign in to comment.