If you run Open Policy Agent (OPA) in production, you already know it decides who can do what, when, and where. What you may not know is how many decisions slip past your radar. Auditing OPA isn’t just about compliance—it’s about trust, visibility, and control.
OPA makes authorization fast, but without proper auditing, you’re flying blind. Every decision—allow, deny, or conditional—should leave a trace you can search, store, and analyze. This isn’t just for debugging. It’s about creating a living record of how policy shapes the behavior of your systems.
The starting point is to enable decision logging. OPA can stream decision events in JSON to stdout, file systems, or remote services. But raw data isn’t enough. Good auditing means structuring these logs with queryable fields: input context, policy version, decision ID, and timestamp. Add metadata so you can answer questions no one has asked yet.
Once data is flowing, the key is to centralize it. Send it all into a system that can index, filter, and report at scale. Correlate OPA decisions with application logs and user activity. Spot anomalies: the user who suddenly accesses a new domain, the spike in denies after a policy update, the forgotten service account making unexpected calls at midnight.