Documentation ¶
Overview ¶
Package logger provides the accesslog logging logic for all proxies
Index ¶
Constants ¶
const ( FieldType = "type" FieldVerdict = "verdict" FieldCode = "code" FieldMethod = "method" FieldURL = "url" FieldProtocol = "protocol" FieldHeader = "header" FieldFilePath = logfields.Path FieldMessage = "message" )
fields used for structured logging
const ( FieldKafkaAPIKey = "kafkaApiKey" FieldKafkaAPIVersion = "kafkaApiVersion" FieldKafkaCorrelationID = "kafkaCorrelationID" )
fields used for structured logging of Kafka messages
Variables ¶
var LogTags logTags
LogTags are optional structured tags that can be attached to log records. See NewLogRecord() and ApplyTags() for example usage.
Functions ¶
func SetEndpointInfoRegistry ¶
func SetEndpointInfoRegistry(epInfoRegistry EndpointInfoRegistry)
func SetMetadata ¶
func SetMetadata(md []string)
SetMetadata sets the metadata to include in each record
func SetNotifier ¶
func SetNotifier(n LogRecordNotifier)
SetNotifier sets the notifier to call for all L7 records
Types ¶
type AddressingInfo ¶
type AddressingInfo struct { SrcIPPort string DstIPPort string SrcIdentity identity.NumericIdentity DstIdentity identity.NumericIdentity }
AddressingInfo is the information passed in via the Addressing() tag
type EndpointInfoRegistry ¶
type EndpointInfoRegistry interface { // FillEndpointInfo resolves the labels of the specified identity if known locally. // If 'id' is passed as zero, will locate the EP by 'ip', and also fill info.ID, if found. // Fills in the following info member fields: // - info.IPv4 (if 'ip' is IPv4) // - info.IPv6 (if 'ip' is not IPv4) // - info.Identity (defaults to WORLD if not known) // - info.Labels (only if identity is found) FillEndpointInfo(info *accesslog.EndpointInfo, addr netip.Addr, id identity.NumericIdentity) }
EndpointInfoRegistry provides endpoint information lookup by endpoint IP address.
type LogRecord ¶
LogRecord is a proxy log record based off accesslog.LogRecord.
func NewLogRecord ¶
NewLogRecord creates a new log record and applies optional tags
Example: record := logger.NewLogRecord(flowType, observationPoint, logger.LogTags.Timestamp(time.Now()))
type LogRecordNotifier ¶
type LogRecordNotifier interface { // NewProxyLogRecord is called for each new log record NewProxyLogRecord(l *LogRecord) error }
LogRecordNotifier is the interface to implement LogRecord notifications. Each type that wants to implement this interface must support concurrent calls to the interface methods. Besides, the number of concurrent calls may be very high, so long critical sections should be avoided (i.e.: avoid using a single lock for slow logging operations).
func NewMonitorAgentLogRecordNotifier ¶
func NewMonitorAgentLogRecordNotifier(monitorAgent monitoragent.Agent) LogRecordNotifier