Skip to content

Decision logging currently disabled #422

@maltesander

Description

@maltesander

In the OPA server config.yaml we can activate logging decisions to the console (see https://www.openpolicyagent.org/docs/latest/configuration/#decision-logs), which in turn would be picked up by vector.

services:
  - name: stackable
    url: http://localhost:3030/opa/v1

bundles:
  stackable:
    service: stackable
    resource: opa/bundle.tar.gz
    persist: true
    polling:
      min_delay_seconds: 10
      max_delay_seconds: 20

decision_logs:
    console: true

We must make this configurable via the CRD.

Proposal

Handling decision logging configuration with the current logging solution described here.

  • There is already a decision logger implemented for decision logs, which can be utilized here to specify the log level for the decision logs. Log level NONE for no decision logs at all and any other level for enabling them.
  • Specifying the log level of the appenders (console or file) can control whether the decision logs would be visible on console, file, none or both.

Example:

logging:                   
    enableVectorAgent: true  
    containers:              
      main-container:
        console:             
          level: INFO # Default: INFO
        file:
          level: INFO # Default: INFO
        loggers:             
          ROOT:
            level: INFO # Default: INFO
          decision:
            level: INFO # Default: NONE
          server:
            level: WARN # Default: null

This would add the decision logs both to console and file. Additionally server logs are printed there as well.

The difference to the prior solution suggestion is that the different logging configurations (decisionLogging and logging), which might affect each other (for example setting decisionLogging.console to true but logging.main-container.console.level to NONE), are less apart and part of the same overall concept, which might reduce confusion when configuring logging. Furthermore, there would be no CRD change in the scope of this issue necessary.

Implementation Considerations

  • OPA is printing logs in a json format including a level field for log level. Filtering logs only with grep is not sufficient. It would be better to parse and filter with jq. For this we would add a script/tool to the OPA image (docker-images/opa/stackable/bin) -> jq needs to be added to the docker image
  • Default values suggestion: Everything set to INFO and decision logging to NONE

Workaround

  1. Stop reconciling the OpaCluster using `spec.clusterOperation.reconciliationPaused: true
  2. Manually edit the Configmap containing the OPA config and add
decision_logs:
    console: true
  1. Restart OPA Pods
  • The end-to-end-security demo is updated (in case it makes sense)
  • Adjust Trino integration-test
### Tasks
- [ ] https://github.com/stackabletech/docker-images/pull/695
- [ ] https://github.com/stackabletech/opa-operator/pull/555

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions