accesslog

package
v0.24.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package accesslog provides request filters that give the ability to override AccessLogDisabled setting.

How It Works

There are two filters that change the state of access log "disableAccessLog" and "enableAccessLog". If "disableAccessLog" is present access log entries for this route won't be produced even if global AccessLogDisabled is false. Otherwise, if "enableAccessLog" filter is present access log entries for this route will be produced even if global AccessLogDisabled is true.

Usage

enableAccessLog()
disableAccessLog()

Note: accessLogDisabled("true") filter is deprecated in favor of "disableAccessLog" and "enableAccessLog"

Index

Constants

View Source
const (
	// Deprecated, use filters.DisableAccessLogName instead
	DisableAccessLogName = filters.DisableAccessLogName

	// Deprecated, use filters.EnableAccessLogName instead
	EnableAccessLogName = filters.EnableAccessLogName

	// AccessLogEnabledKey is the key used in the state bag to pass the access log state to the proxy.
	AccessLogEnabledKey = "statebag:access_log:proxy:enabled"

	// AccessLogAdditionalDataKey is the key used in the state bag to pass extra data to access log
	AccessLogAdditionalDataKey = "statebag:access_log:additional"

	// KeyMaskedQueryParams is the key used to store and retrieve masked query parameters
	// from the additional data.
	KeyMaskedQueryParams = "maskedQueryParams"
)
View Source
const (
	// Deprecated: use DisableAccessLogName or EnableAccessLogName
	AccessLogDisabledName = "accessLogDisabled"
)

Variables

This section is empty.

Functions

func NewAccessLogDisabled deprecated

func NewAccessLogDisabled() filters.Spec

NewAccessLogDisabled creates a filter spec for overriding the state of the AccessLogDisabled setting. (By default global setting is used.)

accessLogDisabled("false")

Deprecated: use disableAccessLog or enableAccessLog

func NewDisableAccessLog added in v0.10.113

func NewDisableAccessLog() filters.Spec

NewDisableAccessLog creates a filter spec to disable access log for specific route. Optionally takes in response code prefixes as arguments. When provided, access log is disabled only if response code matches one of the arguments.

disableAccessLog() or
disableAccessLog(1, 20, 301)  to disable logs for 1xx, 20x and 301 codes

func NewEnableAccessLog added in v0.10.113

func NewEnableAccessLog() filters.Spec

NewEnableAccessLog creates a filter spec to enable access log for specific route Optionally takes in response code prefixes as arguments. When provided, access log is enabled only if response code matches one of the arguments.

enableAccessLog()
enableAccessLog(1, 20, 301)  to enable logs for 1xx, 20x and 301 codes

func NewMaskAccessLogQuery added in v0.22.187

func NewMaskAccessLogQuery() filters.Spec

NewMaskAccessLogQuery creates a filter spec to mask specific query parameters from the access log for a specific route. Takes in query param keys as arguments. When provided, the value of these keys are masked (i.e., hashed).

maskAccessLogQuery("key_1", "key_2") to mask the value of provided keys in the access log.

Types

type AccessLogFilter added in v0.10.157

type AccessLogFilter struct {
	// Enable represents whether or not the access log is enabled.
	Enable bool
	// Prefixes contains the list of response code prefixes.
	Prefixes []int
	// MaskedQueryParams contains the set of query parameters (keys) that are masked/obfuscated in the access log.
	MaskedQueryParams map[string]struct{}
}

AccessLogFilter stores access log state

func (*AccessLogFilter) Request added in v0.10.157

func (al *AccessLogFilter) Request(ctx filters.FilterContext)

func (*AccessLogFilter) Response added in v0.10.157

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL