logging

package
v2.8.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: Apache-2.0 Imports: 26 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendEncoder added in v2.8.0

type AppendEncoder struct {
	// The underlying encoder that actually encodes the
	// log entries. If not specified, defaults to "json",
	// unless the output is a terminal, in which case
	// it defaults to "console".
	WrappedRaw json.RawMessage `json:"wrap,omitempty" caddy:"namespace=caddy.logging.encoders inline_key=format"`

	// A map of field names to their values. The values
	// can be global placeholders (e.g. env vars), or constants.
	// Note that the encoder does not run as part of an HTTP
	// request context, so request placeholders are not available.
	Fields map[string]any `json:"fields,omitempty"`
	// contains filtered or unexported fields
}

AppendEncoder can be used to add fields to all log entries that pass through it. It is a wrapper around another encoder, which it uses to actually encode the log entries. It is most useful for adding information about the Caddy instance that is producing the log entries, possibly via an environment variable.

func (AppendEncoder) AddArray added in v2.8.0

func (fe AppendEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error

AddArray is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddBinary added in v2.8.0

func (fe AppendEncoder) AddBinary(key string, value []byte)

AddBinary is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddBool added in v2.8.0

func (fe AppendEncoder) AddBool(key string, value bool)

AddBool is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddByteString added in v2.8.0

func (fe AppendEncoder) AddByteString(key string, value []byte)

AddByteString is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddComplex128 added in v2.8.0

func (fe AppendEncoder) AddComplex128(key string, value complex128)

AddComplex128 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddComplex64 added in v2.8.0

func (fe AppendEncoder) AddComplex64(key string, value complex64)

AddComplex64 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddDuration added in v2.8.0

func (fe AppendEncoder) AddDuration(key string, value time.Duration)

AddDuration is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddFloat32 added in v2.8.0

func (fe AppendEncoder) AddFloat32(key string, value float32)

AddFloat32 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddFloat64 added in v2.8.0

func (fe AppendEncoder) AddFloat64(key string, value float64)

AddFloat64 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddInt added in v2.8.0

func (fe AppendEncoder) AddInt(key string, value int)

AddInt is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddInt16 added in v2.8.0

func (fe AppendEncoder) AddInt16(key string, value int16)

AddInt16 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddInt32 added in v2.8.0

func (fe AppendEncoder) AddInt32(key string, value int32)

AddInt32 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddInt64 added in v2.8.0

func (fe AppendEncoder) AddInt64(key string, value int64)

AddInt64 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddInt8 added in v2.8.0

func (fe AppendEncoder) AddInt8(key string, value int8)

AddInt8 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddObject added in v2.8.0

func (fe AppendEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error

AddObject is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddReflected added in v2.8.0

func (fe AppendEncoder) AddReflected(key string, value any) error

AddReflected is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddString added in v2.8.0

func (fe AppendEncoder) AddString(key, value string)

AddString is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddTime added in v2.8.0

func (fe AppendEncoder) AddTime(key string, value time.Time)

AddTime is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddUint added in v2.8.0

func (fe AppendEncoder) AddUint(key string, value uint)

AddUint is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddUint16 added in v2.8.0

func (fe AppendEncoder) AddUint16(key string, value uint16)

AddUint16 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddUint32 added in v2.8.0

func (fe AppendEncoder) AddUint32(key string, value uint32)

AddUint32 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddUint64 added in v2.8.0

func (fe AppendEncoder) AddUint64(key string, value uint64)

AddUint64 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddUint8 added in v2.8.0

func (fe AppendEncoder) AddUint8(key string, value uint8)

AddUint8 is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) AddUintptr added in v2.8.0

func (fe AppendEncoder) AddUintptr(key string, value uintptr)

AddUintptr is part of the zapcore.ObjectEncoder interface.

func (AppendEncoder) CaddyModule added in v2.8.0

func (AppendEncoder) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (AppendEncoder) Clone added in v2.8.0

func (fe AppendEncoder) Clone() zapcore.Encoder

Clone is part of the zapcore.ObjectEncoder interface.

func (*AppendEncoder) ConfigureDefaultFormat added in v2.8.0

func (fe *AppendEncoder) ConfigureDefaultFormat(wo caddy.WriterOpener) error

ConfigureDefaultFormat will set the default format to "console" if the writer is a terminal. If already configured, it passes through the writer so a deeply nested encoder can configure its own default format.

func (AppendEncoder) EncodeEntry added in v2.8.0

func (fe AppendEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

EncodeEntry partially implements the zapcore.Encoder interface.

func (AppendEncoder) OpenNamespace added in v2.8.0

func (fe AppendEncoder) OpenNamespace(key string)

OpenNamespace is part of the zapcore.ObjectEncoder interface.

func (*AppendEncoder) Provision added in v2.8.0

func (fe *AppendEncoder) Provision(ctx caddy.Context) error

Provision sets up the encoder.

func (*AppendEncoder) UnmarshalCaddyfile added in v2.8.0

func (fe *AppendEncoder) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:

append {
    wrap <another encoder>
    fields {
        <field> <value>
    }
    <field> <value>
}

type ConsoleEncoder

type ConsoleEncoder struct {
	zapcore.Encoder `json:"-"`
	LogEncoderConfig
}

ConsoleEncoder encodes log entries that are mostly human-readable.

func (ConsoleEncoder) CaddyModule

func (ConsoleEncoder) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*ConsoleEncoder) Provision

func (ce *ConsoleEncoder) Provision(_ caddy.Context) error

Provision sets up the encoder.

func (*ConsoleEncoder) UnmarshalCaddyfile

func (ce *ConsoleEncoder) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:

console {
    <common encoder config subdirectives...>
}

See the godoc on the LogEncoderConfig type for the syntax of subdirectives that are common to most/all encoders.

type CookieFilter added in v2.5.0

type CookieFilter struct {
	// A list of actions to apply to the cookies.
	Actions []cookieFilterAction `json:"actions"`
}

CookieFilter is a Caddy log field filter that filters cookies.

This filter updates the logged HTTP header string to remove, replace or hash cookies containing sensitive data. For instance, it can be used to redact any kind of secrets, such as session IDs.

If several actions are configured for the same cookie name, only the first will be applied.

func (CookieFilter) CaddyModule added in v2.5.0

func (CookieFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (CookieFilter) Filter added in v2.5.0

func (m CookieFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field.

func (*CookieFilter) UnmarshalCaddyfile added in v2.5.0

func (m *CookieFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

func (*CookieFilter) Validate added in v2.5.0

func (f *CookieFilter) Validate() error

Validate checks that action types are correct.

type DeleteFilter

type DeleteFilter struct{}

DeleteFilter is a Caddy log field filter that deletes the field.

func (DeleteFilter) CaddyModule

func (DeleteFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (DeleteFilter) Filter

func (DeleteFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field.

func (DeleteFilter) UnmarshalCaddyfile added in v2.2.0

func (DeleteFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

type FileWriter

type FileWriter struct {
	// Filename is the name of the file to write.
	Filename string `json:"filename,omitempty"`

	// Roll toggles log rolling or rotation, which is
	// enabled by default.
	Roll *bool `json:"roll,omitempty"`

	// When a log file reaches approximately this size,
	// it will be rotated.
	RollSizeMB int `json:"roll_size_mb,omitempty"`

	// Whether to compress rolled files. Default: true
	RollCompress *bool `json:"roll_gzip,omitempty"`

	// Whether to use local timestamps in rolled filenames.
	// Default: false
	RollLocalTime bool `json:"roll_local_time,omitempty"`

	// The maximum number of rolled log files to keep.
	// Default: 10
	RollKeep int `json:"roll_keep,omitempty"`

	// How many days to keep rolled log files. Default: 90
	RollKeepDays int `json:"roll_keep_days,omitempty"`
}

FileWriter can write logs to files. By default, log files are rotated ("rolled") when they get large, and old log files get deleted, to ensure that the process does not exhaust disk space.

func (FileWriter) CaddyModule

func (FileWriter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (FileWriter) OpenWriter

func (fw FileWriter) OpenWriter() (io.WriteCloser, error)

OpenWriter opens a new file writer.

func (*FileWriter) Provision

func (fw *FileWriter) Provision(ctx caddy.Context) error

Provision sets up the module

func (FileWriter) String

func (fw FileWriter) String() string

func (*FileWriter) UnmarshalCaddyfile

func (fw *FileWriter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:

file <filename> {
    roll_disabled
    roll_size     <size>
    roll_uncompressed
    roll_local_time
    roll_keep     <num>
    roll_keep_for <days>
}

The roll_size value has megabyte resolution. Fractional values are rounded up to the next whole megabyte (MiB).

By default, compression is enabled, but can be turned off by setting the roll_uncompressed option.

The roll_keep_for duration has day resolution. Fractional values are rounded up to the next whole number of days.

If any of the roll_size, roll_keep, or roll_keep_for subdirectives are omitted or set to a zero value, then Caddy's default value for that subdirective is used.

func (FileWriter) WriterKey

func (fw FileWriter) WriterKey() string

WriterKey returns a unique key representing this fw.

type FilterEncoder

type FilterEncoder struct {
	// The underlying encoder that actually encodes the
	// log entries. If not specified, defaults to "json",
	// unless the output is a terminal, in which case
	// it defaults to "console".
	WrappedRaw json.RawMessage `json:"wrap,omitempty" caddy:"namespace=caddy.logging.encoders inline_key=format"`

	// A map of field names to their filters. Note that this
	// is not a module map; the keys are field names.
	//
	// Nested fields can be referenced by representing a
	// layer of nesting with `>`. In other words, for an
	// object like `{"a":{"b":0}}`, the inner field can
	// be referenced as `a>b`.
	//
	// The following fields are fundamental to the log and
	// cannot be filtered because they are added by the
	// underlying logging library as special cases: ts,
	// level, logger, and msg.
	FieldsRaw map[string]json.RawMessage `json:"fields,omitempty" caddy:"namespace=caddy.logging.encoders.filter inline_key=filter"`

	Fields map[string]LogFieldFilter `json:"-"`
	// contains filtered or unexported fields
}

FilterEncoder can filter (manipulate) fields on log entries before they are actually encoded by an underlying encoder.

func (FilterEncoder) AddArray

func (fe FilterEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error

AddArray is part of the zapcore.ObjectEncoder interface. Array elements do not get filtered.

func (FilterEncoder) AddBinary

func (fe FilterEncoder) AddBinary(key string, value []byte)

AddBinary is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddBool

func (fe FilterEncoder) AddBool(key string, value bool)

AddBool is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddByteString

func (fe FilterEncoder) AddByteString(key string, value []byte)

AddByteString is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddComplex128

func (fe FilterEncoder) AddComplex128(key string, value complex128)

AddComplex128 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddComplex64

func (fe FilterEncoder) AddComplex64(key string, value complex64)

AddComplex64 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddDuration

func (fe FilterEncoder) AddDuration(key string, value time.Duration)

AddDuration is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddFloat32

func (fe FilterEncoder) AddFloat32(key string, value float32)

AddFloat32 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddFloat64

func (fe FilterEncoder) AddFloat64(key string, value float64)

AddFloat64 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddInt

func (fe FilterEncoder) AddInt(key string, value int)

AddInt is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddInt16

func (fe FilterEncoder) AddInt16(key string, value int16)

AddInt16 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddInt32

func (fe FilterEncoder) AddInt32(key string, value int32)

AddInt32 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddInt64

func (fe FilterEncoder) AddInt64(key string, value int64)

AddInt64 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddInt8

func (fe FilterEncoder) AddInt8(key string, value int8)

AddInt8 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddObject

func (fe FilterEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error

AddObject is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddReflected

func (fe FilterEncoder) AddReflected(key string, value any) error

AddReflected is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddString

func (fe FilterEncoder) AddString(key, value string)

AddString is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddTime

func (fe FilterEncoder) AddTime(key string, value time.Time)

AddTime is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddUint

func (fe FilterEncoder) AddUint(key string, value uint)

AddUint is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddUint16

func (fe FilterEncoder) AddUint16(key string, value uint16)

AddUint16 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddUint32

func (fe FilterEncoder) AddUint32(key string, value uint32)

AddUint32 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddUint64

func (fe FilterEncoder) AddUint64(key string, value uint64)

AddUint64 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddUint8

func (fe FilterEncoder) AddUint8(key string, value uint8)

AddUint8 is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) AddUintptr

func (fe FilterEncoder) AddUintptr(key string, value uintptr)

AddUintptr is part of the zapcore.ObjectEncoder interface.

func (FilterEncoder) CaddyModule

func (FilterEncoder) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (FilterEncoder) Clone

func (fe FilterEncoder) Clone() zapcore.Encoder

Clone is part of the zapcore.ObjectEncoder interface. We don't use it as of Oct 2019 (v2 beta 7), I'm not really sure what it'd be useful for in our case.

func (*FilterEncoder) ConfigureDefaultFormat added in v2.8.0

func (fe *FilterEncoder) ConfigureDefaultFormat(wo caddy.WriterOpener) error

ConfigureDefaultFormat will set the default format to "console" if the writer is a terminal. If already configured as a filter encoder, it passes through the writer so a deeply nested filter encoder can configure its own default format.

func (FilterEncoder) EncodeEntry

func (fe FilterEncoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

EncodeEntry partially implements the zapcore.Encoder interface.

func (FilterEncoder) OpenNamespace

func (fe FilterEncoder) OpenNamespace(key string)

OpenNamespace is part of the zapcore.ObjectEncoder interface.

func (*FilterEncoder) Provision

func (fe *FilterEncoder) Provision(ctx caddy.Context) error

Provision sets up the encoder.

func (*FilterEncoder) UnmarshalCaddyfile added in v2.2.0

func (fe *FilterEncoder) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:

filter {
    wrap <another encoder>
    fields {
        <field> <filter> {
            <filter options>
        }
    }
    <field> <filter> {
        <filter options>
    }
}

type HashFilter added in v2.5.0

type HashFilter struct{}

HashFilter is a Caddy log field filter that replaces the field with the initial 4 bytes of the SHA-256 hash of the content. Operates on string fields, or on arrays of strings where each string is hashed.

func (HashFilter) CaddyModule added in v2.5.0

func (HashFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*HashFilter) Filter added in v2.5.0

func (f *HashFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field with the replacement value.

func (*HashFilter) UnmarshalCaddyfile added in v2.5.0

func (f *HashFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

type IPMaskFilter

type IPMaskFilter struct {
	// The IPv4 mask, as an subnet size CIDR.
	IPv4MaskRaw int `json:"ipv4_cidr,omitempty"`

	// The IPv6 mask, as an subnet size CIDR.
	IPv6MaskRaw int `json:"ipv6_cidr,omitempty"`
	// contains filtered or unexported fields
}

IPMaskFilter is a Caddy log field filter that masks IP addresses in a string, or in an array of strings. The string may be a comma separated list of IP addresses, where all of the values will be masked.

func (IPMaskFilter) CaddyModule

func (IPMaskFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (IPMaskFilter) Filter

func (m IPMaskFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field.

func (*IPMaskFilter) Provision added in v2.2.0

func (m *IPMaskFilter) Provision(ctx caddy.Context) error

Provision parses m's IP masks, from integers.

func (*IPMaskFilter) UnmarshalCaddyfile added in v2.2.0

func (m *IPMaskFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

type JSONEncoder

type JSONEncoder struct {
	zapcore.Encoder `json:"-"`
	LogEncoderConfig
}

JSONEncoder encodes entries as JSON.

func (JSONEncoder) CaddyModule

func (JSONEncoder) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*JSONEncoder) Provision

func (je *JSONEncoder) Provision(_ caddy.Context) error

Provision sets up the encoder.

func (*JSONEncoder) UnmarshalCaddyfile

func (je *JSONEncoder) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:

json {
    <common encoder config subdirectives...>
}

See the godoc on the LogEncoderConfig type for the syntax of subdirectives that are common to most/all encoders.

type LogEncoderConfig

type LogEncoderConfig struct {
	MessageKey    *string `json:"message_key,omitempty"`
	LevelKey      *string `json:"level_key,omitempty"`
	TimeKey       *string `json:"time_key,omitempty"`
	NameKey       *string `json:"name_key,omitempty"`
	CallerKey     *string `json:"caller_key,omitempty"`
	StacktraceKey *string `json:"stacktrace_key,omitempty"`
	LineEnding    *string `json:"line_ending,omitempty"`

	// Recognized values are: unix_seconds_float, unix_milli_float, unix_nano, iso8601, rfc3339, rfc3339_nano, wall, wall_milli, wall_nano, common_log.
	// The value may also be custom format per the Go `time` package layout specification, as described [here](https://pkg.go.dev/time#pkg-constants).
	TimeFormat string `json:"time_format,omitempty"`
	TimeLocal  bool   `json:"time_local,omitempty"`

	// Recognized values are: s/second/seconds, ns/nano/nanos, ms/milli/millis, string.
	// Empty and unrecognized value default to seconds.
	DurationFormat string `json:"duration_format,omitempty"`

	// Recognized values are: lower, upper, color.
	// Empty and unrecognized value default to lower.
	LevelFormat string `json:"level_format,omitempty"`
}

LogEncoderConfig holds configuration common to most encoders.

func (*LogEncoderConfig) UnmarshalCaddyfile

func (lec *LogEncoderConfig) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile populates the struct from Caddyfile tokens. Syntax:

{
    message_key     <key>
    level_key       <key>
    time_key        <key>
    name_key        <key>
    caller_key      <key>
    stacktrace_key  <key>
    line_ending     <char>
    time_format     <format>
    time_local
    duration_format <format>
    level_format    <format>
}

func (*LogEncoderConfig) ZapcoreEncoderConfig

func (lec *LogEncoderConfig) ZapcoreEncoderConfig() zapcore.EncoderConfig

ZapcoreEncoderConfig returns the equivalent zapcore.EncoderConfig. If lec is nil, zap.NewProductionEncoderConfig() is returned.

type LogFieldFilter

type LogFieldFilter interface {
	Filter(zapcore.Field) zapcore.Field
}

LogFieldFilter can filter (or manipulate) a field in a log entry.

type NetWriter

type NetWriter struct {
	// The address of the network socket to which to connect.
	Address string `json:"address,omitempty"`

	// The timeout to wait while connecting to the socket.
	DialTimeout caddy.Duration `json:"dial_timeout,omitempty"`

	// If enabled, allow connections errors when first opening the
	// writer. The error and subsequent log entries will be reported
	// to stderr instead until a connection can be re-established.
	SoftStart bool `json:"soft_start,omitempty"`
	// contains filtered or unexported fields
}

NetWriter implements a log writer that outputs to a network socket. If the socket goes down, it will dump logs to stderr while it attempts to reconnect.

func (NetWriter) CaddyModule

func (NetWriter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (NetWriter) OpenWriter

func (nw NetWriter) OpenWriter() (io.WriteCloser, error)

OpenWriter opens a new network connection.

func (*NetWriter) Provision

func (nw *NetWriter) Provision(ctx caddy.Context) error

Provision sets up the module.

func (NetWriter) String

func (nw NetWriter) String() string

func (*NetWriter) UnmarshalCaddyfile

func (nw *NetWriter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:

net <address> {
    dial_timeout <duration>
    soft_start
}

func (NetWriter) WriterKey

func (nw NetWriter) WriterKey() string

WriterKey returns a unique key representing this nw.

type QueryFilter added in v2.5.0

type QueryFilter struct {
	// A list of actions to apply to the query parameters of the URL.
	Actions []queryFilterAction `json:"actions"`
}

QueryFilter is a Caddy log field filter that filters query parameters from a URL.

This filter updates the logged URL string to remove, replace or hash query parameters containing sensitive data. For instance, it can be used to redact any kind of secrets which were passed as query parameters, such as OAuth access tokens, session IDs, magic link tokens, etc.

func (QueryFilter) CaddyModule added in v2.5.0

func (QueryFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (QueryFilter) Filter added in v2.5.0

func (m QueryFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field.

func (*QueryFilter) UnmarshalCaddyfile added in v2.5.0

func (m *QueryFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

func (*QueryFilter) Validate added in v2.5.0

func (f *QueryFilter) Validate() error

Validate checks that action types are correct.

type RegexpFilter added in v2.5.0

type RegexpFilter struct {
	// The regular expression pattern defining what to replace.
	RawRegexp string `json:"regexp,omitempty"`

	// The value to use as replacement
	Value string `json:"value,omitempty"`
	// contains filtered or unexported fields
}

RegexpFilter is a Caddy log field filter that replaces the field matching the provided regexp with the indicated string. If the field is an array of strings, each of them will have the regexp replacement applied.

func (RegexpFilter) CaddyModule added in v2.5.0

func (RegexpFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*RegexpFilter) Filter added in v2.5.0

func (f *RegexpFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field with the replacement value if it matches the regexp.

func (*RegexpFilter) Provision added in v2.5.0

func (m *RegexpFilter) Provision(ctx caddy.Context) error

Provision compiles m's regexp.

func (*RegexpFilter) UnmarshalCaddyfile added in v2.5.0

func (f *RegexpFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

type RenameFilter added in v2.5.1

type RenameFilter struct {
	Name string `json:"name,omitempty"`
}

RenameFilter is a Caddy log field filter that renames the field's key with the indicated name.

func (RenameFilter) CaddyModule added in v2.5.1

func (RenameFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*RenameFilter) Filter added in v2.5.1

func (f *RenameFilter) Filter(in zapcore.Field) zapcore.Field

Filter renames the input field with the replacement name.

func (*RenameFilter) UnmarshalCaddyfile added in v2.5.1

func (f *RenameFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

type ReplaceFilter added in v2.4.0

type ReplaceFilter struct {
	Value string `json:"value,omitempty"`
}

ReplaceFilter is a Caddy log field filter that replaces the field with the indicated string.

func (ReplaceFilter) CaddyModule added in v2.4.0

func (ReplaceFilter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*ReplaceFilter) Filter added in v2.4.0

func (f *ReplaceFilter) Filter(in zapcore.Field) zapcore.Field

Filter filters the input field with the replacement value.

func (*ReplaceFilter) UnmarshalCaddyfile added in v2.4.0

func (f *ReplaceFilter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the module from Caddyfile tokens.

Jump to

Keyboard shortcuts

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