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

"add" filters to inject fields in log records #2885

Open
bprieur opened this issue Dec 2, 2024 · 3 comments
Open

"add" filters to inject fields in log records #2885

bprieur opened this issue Dec 2, 2024 · 3 comments

Comments

@bprieur
Copy link

bprieur commented Dec 2, 2024

Environment: openshift 4.16
Operator channel: 6.x

Like prune filter to delete some fields, it should be great having a filter to inject fields in log records.

Or maybe this feature is out of scope of this operator and aggregators are needed between collectors and receivers?

Some example :

apiVersion: logging.openshift.io/v1
kind: ClusterLogForwarder
metadata:
# ...
spec:
  filters:
    - name: <filter_name>
      type: add
      add:
        # <key>: <value>
        tag: "openshift.app.{.kubernetes.pod_name||default}"
apiVersion: logging.openshift.io/v1
kind: ClusterLogForwarder
metadata:
# ...
spec:
  filters:
    - name: <filter_name>
      type: add_pattern
      from:
        - key: kubernetes.namespace_name
          ref: myref
          pattern: ^(.+)-(.+)-(.+)$
      add:
        # <key>: <value>
        tag: "openshift.app.$myref[1]"
@jcantrill
Copy link
Contributor

There is an "openshift labels" filter that allows adding custom labels not defined on a pod. This would seem to accomplish the same goal though slightly more opinionated

@bprieur
Copy link
Author

bprieur commented Dec 3, 2024

I saw this one, but this filter allows us only to add fields through the "openshift.labels" field.

Is there a good practice behind this filter?

@jcantrill
Copy link
Contributor

I saw this one, but this filter allows us only to add fields through the "openshift.labels" field.
Is there a good practice behind this filter?

I'm not certain I understand your question. This is akin to adding a label to a kubernetes workload which AFAIK is the recommended way to provide additional customization. The filter allows you to provide additional labels to logs flowing through a pipeline without needing to update a pod spec. I frankly do not understand the need to move field values from one location in the payload to another when it is possible to craft a query using the existing field locations. Regardless, I do not imagine us taking up a filter to accomplish what you define here unless there is an overwhelming customer need for it. It potentially will require implementing a "field selection" grammer for which we do not desire to create and maintain. The path selection that exists now is a subset of what vector's VRL provides now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants