These are the docs for an older version of OPA. Latest stable release is v0.44.0
Decision Logs Edit

OPA can periodically report decision logs to remote HTTP servers. The decision logs contain events that describe policy queries. Each event includes the policy that was queried, the input to the query, bundle metadata, and other information that enables auditing and offline debugging of policy decisions.

When decision logging is enabled the OPA server will include a decision_id field in API calls that return policy decisions.

See the Configuration Reference for configuration details.

Decision Log Service API

OPA expects the service to expose an API endpoint that will receive decision logs.

POST /logs[/<partition_name>] HTTP/1.1
Content-Encoding: gzip
Content-Type: application/json

The partition name is an optional path segment that can be used to route logs to different backends. If the partition name is not configured on the agent, updates will be sent to /logs.

The message body contains a gzip compressed JSON array. Each array element (event) represents a policy decision returned by OPA.

    "labels": {
      "app": "my-example-app",
      "id": "1780d507-aea2-45cc-ae50-fa153c8e4a5a",
      "version": "v0.11.0"
    "decision_id": "4ca636c1-55e4-417a-b1d8-4aceb67960d1",
    "revision": "W3sibCI6InN5cy9jYXRhbG9nIiwicyI6NDA3MX1d",
    "path": "http/example/authz/allow",
    "input": {
      "method": "GET",
      "path": "/salary/bob"
    "result": "true",
    "requested_by": "[::1]:59943",
    "timestamp": "2018-01-01T00:00:00.000000Z"

Decision log updates contain the following fields:

Field Type Description
[_].labels object Set of key-value pairs that uniquely identify the OPA instance.
[_].decision_id string Unique identifier generated for each decision for traceability.
[_].revision string Bundle revision that contained the policy used to produce the decision.
[_].path string Hierarchical policy decision path, e.g., /http/example/authz/allow. Receivers should tolerate slash-prefixed paths.
[_].query string Ad-hoc Rego query received by Query API.
[_].input any Input data provided in the policy query.
[_].result any Policy decision returned to the client, e.g., true or false.
[_].requested_by string Identifier for client that executed policy query, e.g., the client address.
[_].timestamp string RFC3999 timestamp of policy decision.
[_].metrics object Key-value pairs of performance metrics.