Skip to content
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

Error while configuring relabel-configs for Lokiclient logger #643

Closed
rajmohanram opened this issue Mar 10, 2024 · 2 comments · Fixed by #664
Closed

Error while configuring relabel-configs for Lokiclient logger #643

rajmohanram opened this issue Mar 10, 2024 · 2 comments · Fixed by #664
Labels
bug Something isn't working

Comments

@rajmohanram
Copy link

Describe the bug
Following error observed while configuing relabel-config for Loki logger. Loki logger configuration as follows:

  loggers:
    - name: loki
      lokiclient:
        server-url: "https://grafana-loki.example.com/loki/api/v1/push"
        job-name: "dnscollector"
        mode: "flat-json"
        tls-insecure: true
        tenant-id: fake
        relabel-configs:
          - source_labels: ["__dns_qtype"]
            target_label: "qtype"

Error observed while starting the go-dnscollector:

config error: unknown YAML key `source_labels` in configuration
config error: unknown YAML key `source_labels` in configuration

To Reproduce
Configure the Loki logger as above.

Expected behavior
Relabel configuration accepted and send logs to the Loki with the required labels.

Additional context

  • version: v0.41.0
@rajmohanram
Copy link
Author

rajmohanram commented Mar 10, 2024

configchecker is not loading the keys related to relabel-configs in defaultKeywords and hence comparison with userKeywords failing.

Can we set a default value for LokiClient RelabelConfigs here, something like this

	c.LokiClient.RelabelConfigs = []*relabel.Config{
		{
			SourceLabels: model.LabelNames{"__dns_qtype"},
			TargetLabel: "qtype",
			Separator: ",",
			Regex: relabel.Regexp{},
			Modulus: 3,
			Replacement: "{$1}",
			Action: "replace",
		},
	}

@dmachard dmachard added the bug Something isn't working label Mar 10, 2024
@dmachard
Copy link
Owner

Thank for the report. I prefer to kept backward compatibility for default values.

But you can add this relabeling config part here.

Feel free to do a pull request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants