Can I configure multiple exporters with different filters?

157 Views Asked by At

I configured my values.yaml to export my logs to different exporters (saas_1/saas_2).

Now it works only one exporter.

I would use 2 exporters at same time with different filters. One of this should receive all logs, the other one should receive only ERROR or CRITICAL logs

This is a part of my values.yaml file

#values.yaml
---
    exporters:
      saas_1:
        endpoint: saas_1
      saas_2:
        endpoint: saas_2

    processors:
      attributes/k8s:
        actions:
          - key: system.displayname
            value: ${K8S_NODE_NAME}
            action: insert
      filter/bodies:
        logs:
          include:
            match_type: regexp
            bodies:
              - ".*\\b(ERROR|CRITICAL)\\b.*"
      filter/namespaces:
        logs:
          include:
            match_type: strict
            resource_attributes:
              - key: "k8s.namespace.name"
                value: "dummy"
---

---  
    service:
      telemetry:
        logs:
          encoding: json
        metrics:
          address: ${MY_POD_IP}:8888
      pipelines:
        traces:
          exporters:
          processors:
          receivers:
        metrics:
          exporters:
          processors:
          receivers:
        logs/1:
          exporters:
            - saas_1
          processors:
            - batch
            - k8sattributes
            - filter/bodies
            - attributes/k8s
          receivers:
            - otlp
        logs/2:
          exporters:
            - saas_2
          processors:
            - batch
            - k8sattributes
          receivers:
            - otlp

I received logs only to saas1 (logs/1) i would receive logs also to saas2 (logs/2)

1

There are 1 best solutions below

2
codeboten On

This should work as you've tried here. The only thing I can see is that it looks like there's an underscore in your exporter configuration saas_1 and saas_2, but your exporters definition defines them as saas1 and saas2. Another question that comes to mind is could it be that the filters for saas2 are excluding everything?