Skip to content

Commit

Permalink
Configure cluster label using logs client external_labels param (graf…
Browse files Browse the repository at this point in the history
…ana#1357)

* Configure cluster label using logs client external_labels param
* Update CHANGELOG.md
  • Loading branch information
hjet committed Feb 4, 2022
1 parent bf37ff4 commit b88f0ec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

- [BUGFIX] Fix issue with windows_exporter mssql collector crashing the agent. (@mattdurham)

- [BUGFIX] Configure eventhandler integration "cluster" label using logs client (@hjet)

# v0.22.0 (2022-01-13)

This release has deprecations. Please read [DEPRECATION] entries and consult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ Configuration reference:
## before abandoning and moving on.
[send_timeout: <int> | default = 60]

## Configures a cluster= label to add to log lines
[cluster_name: <string> | default = "cloud"]

## Configures the path to a kubeconfig file. If not set, will fall back to using
## an in-cluster config. If this fails, will fall back to checking the user's home
## directory for a kubeconfig.
Expand Down Expand Up @@ -57,7 +54,6 @@ server:

integrations:
eventhandler:
cluster_name: "cloud"
cache_path: "/etc/eventhandler/eventhandler.cache"

logs:
Expand All @@ -68,6 +64,8 @@ logs:
basic_auth:
username: YOUR_LOKI_USER
password: YOUR_LOKI_API_KEY
external_labels:
cluster: "cloud"
positions:
filename: /tmp/positions0.yaml
## The following stanza is optional and used to configure another client to forward
Expand Down Expand Up @@ -184,7 +182,6 @@ data:
integrations:
eventhandler:
cluster_name: "cloud"
cache_path: "/etc/eventhandler/eventhandler.cache"
logs:
Expand All @@ -195,6 +192,8 @@ data:
basic_auth:
username: YOUR_LOKI_USER
password: YOUR_LOKI_API_KEY
external_labels:
cluster: "cloud"
positions:
filename: /tmp/positions0.yaml
- name: eventhandler_logs
Expand Down
3 changes: 0 additions & 3 deletions pkg/integrations/v2/eventhandler/eventhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ type EventHandler struct {
LastEvent *ShippedEvents
InitEvent *ShippedEvents
EventInformer cache.SharedIndexInformer
ClusterLabel string
SendTimeout time.Duration
ticker *time.Ticker
sync.Mutex
Expand Down Expand Up @@ -106,7 +105,6 @@ func newEventHandler(l log.Logger, globals integrations.Globals, c *Config) (int
Log: l,
CachePath: c.CachePath,
EventInformer: eventInformer,
ClusterLabel: c.ClusterName,
SendTimeout: time.Duration(c.SendTimeout) * time.Second,
}
// set the resource handler fns
Expand Down Expand Up @@ -206,7 +204,6 @@ func (eh *EventHandler) extractEvent(event *v1.Event) (model.LabelSet, string, e
}

labels[model.LabelName("job")] = model.LabelValue("eventhandler")
labels[model.LabelName("cluster")] = model.LabelValue(eh.ClusterLabel)

kindStr := strings.ToLower(obj.Kind)
// TODO: match up labels with k8s integration so that log / metric correlation works
Expand Down
3 changes: 0 additions & 3 deletions pkg/integrations/v2/eventhandler/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
// DefaultConfig sets defaults for Config
var DefaultConfig = Config{
SendTimeout: 60,
ClusterName: "cloud",
CachePath: "./.eventcache/eventhandler.cache",
LogsInstance: "default",
InformerResync: 120,
Expand All @@ -21,8 +20,6 @@ type Config struct {
// client channel. This parameter configures how long to wait (in seconds) on the channel
// before abandoning and moving on.
SendTimeout int `yaml:"send_timeout,omitempty"`
// Configures a cluster= label to add to log lines
ClusterName string `yaml:"cluster_name,omitempty"`
// Configures the path to a kubeconfig file. If not set, will fall back to using
// an in-cluster config. If this fails, will fall back to checking the user's home
// directory for a kubeconfig.
Expand Down

0 comments on commit b88f0ec

Please sign in to comment.