-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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: trueWe 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
NONEfor no decision logs at all and any other level for enabling them. - Specifying the log level of the appenders (
consoleorfile) 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: nullThis 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
levelfield for log level. Filtering logs only withgrepis 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
INFOand decision logging toNONE
Workaround
- Stop reconciling the OpaCluster using `spec.clusterOperation.reconciliationPaused: true
- Manually edit the Configmap containing the OPA config and add
decision_logs:
console: true- Restart OPA Pods
- The
end-to-end-securitydemo 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
Labels
Type
Projects
Status
Status