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

I am making an api call in opa policy and when api throws an error or exception I need a way to track those errors in the console logs. Is there a way to customize decision logs and logs those errors with log level as error and also let's say I am middle of policy validation and one of the header is missing or some field is invalid I want to log such thing as error. So that when I look into container logs I should able to figure it out why opa allow decision is false #6694

Closed
sriram1545 opened this issue Apr 12, 2024 · 1 comment

Comments

@sriram1545
Copy link

sriram1545 commented Apr 12, 2024

What is the underlying problem you're trying to solve?

This will tell me where exactly my opa validation failed or what cause the opa validation allowed as false.

Since I didn't any solution I used print statement when an error occurs but when use print statement the decision log is coming as log level as info that doesn't help me when I set log level as error instead of info

Describe the ideal solution

Describe a "Good Enough" solution

Additional Context

@ashutosh-narkar
Copy link
Member

So that when I look into container logs I should able to figure it out why opa allow decision is false

You can define your policy to return an object response for example which can contain more context about why a decision was made. More on that here. This will then be included in the decision logs.

Feel free to start a Discussions thread if you need more help on this. Also sharing your policy, input and other relevant data is always helpful. Thanks.

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

No branches or pull requests

2 participants