Skip to content

Adding logs on policy failure #132

Discussion options

You must be logged in to vote

The print function is included in OPA for debugging purposes only, and it should not be used as a "logger". Use decision logging if you want to log the decisions OPA takes, which includes the input of the request. If you want to drill down to where rule evaluation stopped in a debugging context, you could either look into tracing, or simply move the print event to the validate rule as you did in your last example. That'll give you the opportunity to at least derive where printing "stops" and what is likely the cause of evaluation to fail. In tests, the coverage feature could also be useful for determining what lines are evaluated and not.

Finally, a pretty common approach is to use partia…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@beepdot
Comment options

Answer selected by beepdot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants