flare

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package flare is used for collecting, sanitizing, and packaging lakeFS configuration, log files, and environment variables for debugging and troubleshooting purposes.

Index

Constants

View Source
const (
	DirPermissions  = 0700
	FilePremissions = 0600
	FlareUmask      = 077
)

Variables

View Source
var (
	ErrExtractDateFromJSONLogLine = errors.New("failed to extract date from log line")
	ErrDateNotFound               = errors.New("date not found in log line")
)

Functions

func SetBaselinePermissions added in v1.28.1

func SetBaselinePermissions(mask int)

SetBaselinePermissions sets the Umask for all files created by flare for posix operating systems on Windows this is a noop as permissions are set according to the parent directory

Types

type FileWriter

type FileWriter struct{}

func (*FileWriter) Close

func (fw *FileWriter) Close() error

func (*FileWriter) GetFileWriter

func (fw *FileWriter) GetFileWriter(name string) (io.WriteCloser, error)

type Flare

type Flare struct {

	// LogDateLayout is the layout used by time.Parse to parse dates in log lines.
	// The default value is time.RFC3339.
	// This can be changed using the WithLogDateLayout option.
	LogDateLayout string
	// contains filtered or unexported fields
}

func NewFlare

func NewFlare(options ...Option) (*Flare, error)

func (*Flare) ProcessConfig

func (f *Flare) ProcessConfig(cfg interface{}, outputPath, fileName string, getWriterFunc GetFileWriterFunc) (retErr error)

ProcessConfig takes a config struct, marshals it to YAML and writes it out to outputPath

func (*Flare) ProcessEnvVars

func (f *Flare) ProcessEnvVars(outPath, fileName string, getWriterFunc GetFileWriterFunc) (retErr error)

ProcessEnvVars iterates over all defined env vars, filters them according to the defined prefixes, redacts secrets, and writes them out to file.

type FlareOutputWriter

type FlareOutputWriter interface {
	GetFileWriter(name string) (io.WriteCloser, error)
	Close() error
}

type GetFileWriterFunc

type GetFileWriterFunc func(name string) (io.WriteCloser, error)

type LogFormat

type LogFormat string

LogFormat is a log file format supported by the flare package

const (
	LogFormatJSON      LogFormat = "json"
	LogFormatPlainText LogFormat = "text"
)

type Option

type Option func(*Flare)

func WithAdditionalEnvVarPrefix

func WithAdditionalEnvVarPrefix(envVar string) Option

WithAdditionalEnvVarPrefix adds additional environment prefixes to the default list that flare processes. The default list is "LAKEFS_", "HTTP_", "HOSTNAME".

func WithEnvVarBlacklist

func WithEnvVarBlacklist(blacklist []string) Option

WithEnvVarBlacklist adds a list of environment variable keys that will be explicitly redacted.

func WithEnvVarPrefixes

func WithEnvVarPrefixes(prefixes []string) Option

WithEnvVarPrefixes replaces the default list of environment variable prefixes that flare processes. The default list is "LAKEFS_", "HTTP_", "HOSTNAME".

func WithSecretReplacerFunc

func WithSecretReplacerFunc(fn RedactedValueReplacer) Option

WithSecretReplacerFunc replaces the default secret replacement func with a function that takes the raw value and returns the redacted value The default secret replacement func replaces the secret with a SHA512 hash of the secret value. This allows comparison of values without exposing the secret values.

type RedactedValueReplacer

type RedactedValueReplacer func(value string) string

type StdoutWriter

type StdoutWriter struct{}

func (*StdoutWriter) Close

func (sw *StdoutWriter) Close() error

func (*StdoutWriter) GetFileWriter

func (sw *StdoutWriter) GetFileWriter(name string) (io.WriteCloser, error)

type StdoutWriterCloser

type StdoutWriterCloser struct {
	io.Writer
}

func (StdoutWriterCloser) Close

func (swc StdoutWriterCloser) Close() error

type WithTime

type WithTime struct {
	Time time.Time
}

type ZipWriter

type ZipWriter struct {
	*zip.Writer
}

func NewZipWriter

func NewZipWriter(zipFileName string) (*ZipWriter, error)

func (*ZipWriter) GetFileWriter

func (zw *ZipWriter) GetFileWriter(name string) (io.WriteCloser, error)

type ZipWriterCloser

type ZipWriterCloser struct {
	io.Writer
}

func (ZipWriterCloser) Close

func (zwc ZipWriterCloser) Close() error

Jump to

Keyboard shortcuts

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