Forward decision logs with the logs forwarder
Forward the decision logs of a policy decision point (PDP) to Elasticsearch, or print them to the stdout of a Fluent Bit container, with the Permit logs forwarder. This page is for operators who deploy the PDP to Kubernetes with the Permit Helm chart and want decision logs in their own logging platform.
The logs forwarder is part of the PDP Helm chart. For a PDP that you run with docker run, print decisions to the container output instead. See Decision logs in the PDP configuration.
Prerequisites
- A PDP deployed with the Permit Helm chart. See Deploy the PDP with Helm.
- For Elasticsearch: the host, port, index, and a user name and password that can write to the index.
How the logs forwarder works
When pdp.logs_forwarder.enabled is true, the Helm chart makes these changes to the PDP pod:
- The PDP container writes its logs to the
/tmp/pdp.logfile on a volume that both containers share. - The chart adds a sidecar container that runs Fluent Bit, an open source log processor and forwarder.
- Fluent Bit reads
/tmp/pdp.log, keeps only the decision log entries, and sends each decision as JSON to the output you choose:stdoutorelasticsearch.
The PDP rotates /tmp/pdp.log by size and deletes rotated files after a retention period. The rotation and retention values control both.
Turn on the logs forwarder
Set these values in your values file for the PDP chart, or pass them with --set. For all chart values, see the chart's values.yaml.
| Value | Default | Description |
|---|---|---|
pdp.logs_forwarder.enabled | false | Set to true to add the Fluent Bit sidecar. |
pdp.logs_forwarder.type | stdout | The output: stdout or elasticsearch. |
pdp.logs_forwarder.elasticsearch.host | None | The Elasticsearch host. Required when type is elasticsearch. |
pdp.logs_forwarder.elasticsearch.port | 443 | The Elasticsearch port. Fluent Bit connects over TLS. |
pdp.logs_forwarder.elasticsearch.index | None | The Elasticsearch index to write decision logs to. |
pdp.logs_forwarder.elasticsearch.cloud_auth | None | The Elasticsearch credentials in the {user}:{password} form. |
pdp.logs_forwarder.rotation | 250 MB | The file size at which the PDP rotates /tmp/pdp.log. |
pdp.logs_forwarder.retention | 3 days | How long the PDP keeps rotated log files. |
pdp.logs_forwarder.debug_mode | false | Set to true to print Fluent Bit's own debug logs. |
To send decision logs to Elasticsearch:
- Set
pdp.logs_forwarder.enabledtotrue. - Set
pdp.logs_forwarder.typetoelasticsearch. - Set
host,port,index, andcloud_authunderpdp.logs_forwarder.elasticsearch. - Run
helm upgradefor the PDP release with the new values.
To print decision logs to stdout, set pdp.logs_forwarder.enabled to true and keep type as stdout, then run helm upgrade.
cloud_auth holds the Elasticsearch password in plain text. Anyone who can run helm get values on the release can read it. Keep the values file out of source control.
Confirm that decision logs are forwarded
- Run a
permit.check()call against the PDP. - Check the output you chose:
- For
stdout: read the logs of thefluentbitcontainer in the PDP pod, for example withkubectl logs <pdp-pod-name> -c fluentbit. The output has a JSON record with adecision_idfor the check. - For
elasticsearch: search the index you set. The index has a document with adecision_idfor the check.
- For
If no decision appears, set pdp.logs_forwarder.debug_mode to true, upgrade the release, and read the fluentbit container logs for connection errors.