kube-logging / logging-operator

Logging operator for Kubernetes
https://kube-logging.dev
Apache License 2.0
1.54k stars 327 forks source link

syslogng: render go templates in metrics-probe label values #1756

Closed orymate closed 4 months ago

orymate commented 4 months ago

This PR adds flexibility in what label keys should be used automatically for output metrics, also adds the ability to use go templates that receives the destination information (name, namespace, scope:local/global and the logging name) to be used as needed. Example:

apiVersion: logging.banzaicloud.io/v1beta1
kind: SyslogNGClusterFlow
metadata:
  name: all
spec:
  match: {}
  outputMetrics:
    - key: custom_output
      labels:
        flow: all
        # define your own label for output name
        my-key-for-the-output: "{{ .Destination.Name }}"
        # do not add the output_name label to the metric
        output_name: ""
  globalOutputRefs:
    - http