opa: github.com/open-policy-agent/opa/plugins/logs Index | Files

package logs

import "github.com/open-policy-agent/opa/plugins/logs"

Package logs implements decision log buffering and uploading.


Package Files

buffer.go encoder.go plugin.go ptr.go


const Name = "decision_logs"

Name identifies the plugin on manager.

type BundleInfoV1 Uses

type BundleInfoV1 struct {
    Revision string `json:"revision,omitempty"`

BundleInfoV1 describes a bundle associated with a decision log event.

type Config Uses

type Config struct {
    Plugin        *string         `json:"plugin"`
    Service       string          `json:"service"`
    PartitionName string          `json:"partition_name,omitempty"`
    Reporting     ReportingConfig `json:"reporting"`
    MaskDecision  *string         `json:"mask_decision"`
    ConsoleLogs   bool            `json:"console"`
    // contains filtered or unexported fields

Config represents the plugin configuration.

func ParseConfig Uses

func ParseConfig(config []byte, services []string, plugins []string) (*Config, error)

ParseConfig validates the config and injects default values.

type EventV1 Uses

type EventV1 struct {
    Labels      map[string]string       `json:"labels"`
    DecisionID  string                  `json:"decision_id"`
    Revision    string                  `json:"revision,omitempty"` // Deprecated: Use Bundles instead
    Bundles     map[string]BundleInfoV1 `json:"bundles,omitempty"`
    Path        string                  `json:"path,omitempty"`
    Query       string                  `json:"query,omitempty"`
    Input       *interface{}            `json:"input,omitempty"`
    Result      *interface{}            `json:"result,omitempty"`
    Erased      []string                `json:"erased,omitempty"`
    Error       error                   `json:"error,omitempty"`
    RequestedBy string                  `json:"requested_by"`
    Timestamp   time.Time               `json:"timestamp"`
    Metrics     map[string]interface{}  `json:"metrics,omitempty"`

EventV1 represents a decision log event.

type Logger Uses

type Logger interface {

    Log(context.Context, EventV1) error

Logger defines the interface for decision logging plugins.

type Plugin Uses

type Plugin struct {
    // contains filtered or unexported fields

Plugin implements decision log buffering and uploading.

func Lookup Uses

func Lookup(manager *plugins.Manager) *Plugin

Lookup returns the decision logs plugin registered with the manager.

func New Uses

func New(parsedConfig *Config, manager *plugins.Manager) *Plugin

New returns a new Plugin with the given config.

func (*Plugin) Log Uses

func (p *Plugin) Log(ctx context.Context, decision *server.Info) error

Log appends a decision log event to the buffer for uploading.

func (*Plugin) Reconfigure Uses

func (p *Plugin) Reconfigure(_ context.Context, config interface{})

Reconfigure notifies the plugin with a new configuration.

func (*Plugin) Start Uses

func (p *Plugin) Start(ctx context.Context) error

Start starts the plugin.

func (*Plugin) Stop Uses

func (p *Plugin) Stop(ctx context.Context)

Stop stops the plugin.

type ReportingConfig Uses

type ReportingConfig struct {
    BufferSizeLimitBytes *int64 `json:"buffer_size_limit_bytes,omitempty"` // max size of in-memory buffer
    UploadSizeLimitBytes *int64 `json:"upload_size_limit_bytes,omitempty"` // max size of upload payload
    MinDelaySeconds      *int64 `json:"min_delay_seconds,omitempty"`       // min amount of time to wait between successful poll attempts
    MaxDelaySeconds      *int64 `json:"max_delay_seconds,omitempty"`       // max amount of time to wait between poll attempts

ReportingConfig represents configuration for the plugin's reporting behaviour.

Package logs imports 23 packages (graph) and is imported by 8 packages. Updated 2020-02-07. Refresh now. Tools for package owners.