Skip to content

Commit

Permalink
add to static mode loki write
Browse files Browse the repository at this point in the history
  • Loading branch information
captncraig committed Dec 18, 2023
1 parent beb872c commit 1b25aea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/logs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"path/filepath"

"github.com/grafana/agent/internal/agentseed"
"github.com/grafana/loki/clients/pkg/promtail/client"
"github.com/grafana/loki/clients/pkg/promtail/limit"
"github.com/grafana/loki/clients/pkg/promtail/positions"
Expand Down Expand Up @@ -75,6 +76,13 @@ func (c *Config) ApplyDefaults() error {
if len(ic.ClientConfigs) == 0 {
ic.ClientConfigs = c.Global.ClientConfigs
}
uid := agentseed.Get().UID
for _, cfg := range ic.ClientConfigs {
if cfg.Headers == nil {
cfg.Headers = map[string]string{}
}
cfg.Headers["X-Agent-UID"] = uid
}
}

return nil
Expand Down

0 comments on commit 1b25aea

Please sign in to comment.