accesslog

package
v0.13.235 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0, MIT Imports: 1 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"
)
View Source
const (
	// Deprecated: use DisableAccessLogName or EnableAccessLogName
	AccessLogDisabledName = "accessLogDisabled"
)

Variables

This section is empty.

Functions

func NewAccessLogDisabled

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

Types

type AccessLogFilter added in v0.10.157

type AccessLogFilter struct {
	Enable   bool
	Prefixes []int
}

Common filter struct for holding 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