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 ¶
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" )
const (
// Deprecated: use DisableAccessLogName or EnableAccessLogName
AccessLogDisabledName = "accessLogDisabled"
)
Variables ¶
This section is empty.
Functions ¶
func NewAccessLogDisabled
deprecated
func NewDisableAccessLog ¶ added in v0.10.113
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
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
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
func (*AccessLogFilter) Response(filters.FilterContext)