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

Filter logs by backstage.io/kubernetes-label-selector #164

Open
jkleinlercher opened this issue Dec 11, 2024 · 1 comment
Open

Filter logs by backstage.io/kubernetes-label-selector #164

jkleinlercher opened this issue Dec 11, 2024 · 1 comment

Comments

@jkleinlercher
Copy link

Summary

How can I display logs based on the backstage.io/kubernetes-label-selector annotation?

I defined this custom query in the app-config.yaml:

fetch logs, from: -1d
                | filter backstageComponent == "$${componentNamespace}.$${componentName}"
                | sort timestamp desc
                | fieldsAdd content=if(isNull(content), "N/A", else: content)
                | fieldsAdd source=if(isNull(log.source), "N/A", else: log.source)
                | fieldsAdd host=if(isNull(host.name), "N/A", else: host.name)
                | fieldsAdd environment = "$${environmentName}"
                | fieldsKeep timestamp, source, content, host, environment

this doesn’t seem to work
filter backstageComponent == "$${componentNamespace}.$${componentName}"

Can you add an example in the Readme?
Also, I want to filter Davis events like this.

Feature Suggestion

Possible Implementation

Context

@jkleinlercher jkleinlercher changed the title Filter logs by Filter logs by backstage.io/kubernetes-label-selector Dec 11, 2024
@johannes-b
Copy link
Collaborator

Hi @jkleinlercher

did you validate the query in a Dynatrace notebook if it works without the placeholders? In other words, does it run if you replace the $$... placeholders?

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