config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDefaultConfigurationYAML added in v1.0.3

func BuildDefaultConfigurationYAML() string

BuildDefaultConfigurationYAML ...

func DefaultGrokLibraryDirs added in v1.0.3

func DefaultGrokLibraryDirs(expand bool) []string

DefaultGrokLibraryDirs ...

func DetermineConfigFilePath added in v0.9.16

func DetermineConfigFilePath() string

DetermineConfigFilePath return (file path)

func InitDefaultGrokLibraryDir added in v1.0.3

func InitDefaultGrokLibraryDir()

InitDefaultGrokLibraryDir ...

func JogHomeDir added in v1.0.3

func JogHomeDir(expand bool, children ...string) string

JogHomeDir ...

func MarshalYAML added in v0.9.16

func MarshalYAML(i DynamicObject) (interface{}, error)

MarshalYAML ...

func ResetDefaultGrokLibraryDir added in v1.0.3

func ResetDefaultGrokLibraryDir()

ResetDefaultGrokLibraryDir ...

func SaveGrokPatternFile added in v1.0.3

func SaveGrokPatternFile(dir string, patternFileName string, patternFileContent string)

SaveGrokPatternFile ...

func ShortenValue added in v1.0.3

func ShortenValue(inValue string, printFormat string) string

ShortenValue shortens the value to maxWidth -3 chars if necessary, shortend values will be postfixed by three dots

func UnmarshalYAML added in v0.9.16

func UnmarshalYAML(i DynamicObject, unmarshal func(interface{}) error) error

UnmarshalYAML ...

Types

type CompressPrefix added in v0.9.5

type CompressPrefix = *CompressPrefixT

CompressPrefix ..

func (CompressPrefix) Compress added in v0.9.5

func (i CompressPrefix) Compress(text string) string

Compress ...

func (CompressPrefix) FromMap added in v0.9.5

func (i CompressPrefix) FromMap(m map[string]interface{}) error

FromMap ...

func (CompressPrefix) Init added in v0.9.16

func (i CompressPrefix) Init(cfg Configuration)

Init ...

func (CompressPrefix) MarshalYAML added in v0.9.5

func (i CompressPrefix) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (CompressPrefix) Reset added in v0.9.5

func (i CompressPrefix) Reset()

Reset ...

func (CompressPrefix) ToMap added in v0.9.5

func (i CompressPrefix) ToMap() map[string]interface{}

ToMap ...

func (CompressPrefix) UnmarshalYAML added in v0.9.5

func (i CompressPrefix) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type CompressPrefixAction added in v0.9.5

type CompressPrefixAction int

CompressPrefixAction ...

const (
	// CompressPrefixActionRemoveNonFirstLetter ...
	CompressPrefixActionRemoveNonFirstLetter CompressPrefixAction = iota

	// CompressPrefixActionRemove ...
	CompressPrefixActionRemove

	// CompressPrefixActionDefault ...
	CompressPrefixActionDefault = CompressPrefixActionRemoveNonFirstLetter
)

func ParseCompressPrefixAction added in v0.9.5

func ParseCompressPrefixAction(text string) CompressPrefixAction

ParseCompressPrefixAction ...

func (CompressPrefixAction) String added in v0.9.5

func (i CompressPrefixAction) String() string

Format ...

type CompressPrefixT added in v0.9.5

type CompressPrefixT struct {
	yaml.Unmarshaler
	yaml.Marshaler

	Enabled    bool
	Separators StringSet
	WhiteList  StringSet
	Action     CompressPrefixAction
}

CompressPrefixT ...

type Configuration added in v0.9.16

type Configuration = *ConfigurationT

Configuration ...

func WithDefaultYamlFile added in v0.9.16

func WithDefaultYamlFile() Configuration

WithDefaultYamlFile ...

func WithYaml added in v0.9.16

func WithYaml(yamlText string) Configuration

WithYaml ...

func WithYamlFile added in v0.9.16

func WithYamlFile(path string) Configuration

WithYamlFile ...

func (Configuration) FromMap added in v0.9.16

func (i Configuration) FromMap(m map[string]interface{}) error

FromMap ...

func (Configuration) HasFieldInPattern added in v0.9.16

func (i Configuration) HasFieldInPattern(fieldName string) bool

HasFieldInPattern ...

func (Configuration) Init added in v0.9.16

func (i Configuration) Init(cfg Configuration)

Init ...

func (Configuration) MarshalYAML added in v0.9.16

func (i Configuration) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Configuration) Reset added in v0.9.16

func (i Configuration) Reset()

Reset ...

func (Configuration) ToMap added in v0.9.16

func (i Configuration) ToMap() map[string]interface{}

ToMap ...

func (Configuration) UnmarshalYAML added in v0.9.16

func (i Configuration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type ConfigurationT added in v0.9.16

type ConfigurationT struct {
	// TODO: configurable
	Colorization bool
	Replace      map[string]string
	Pattern      string

	HasOthersFieldInPattern bool
	StartupLine             StartupLine `yaml:"startup-line"`
	LineNo                  Element     `yaml:"line-no"`
	UnknownLine             Element     `yaml:"unknown-line"`
	Prefix                  Prefix
	Fields                  FieldMap
	LevelField              Field
	TimestampField          Field
	Grok                    Grok
	// contains filtered or unexported fields
}

ConfigurationT ...

type DynamicObject added in v0.9.16

type DynamicObject interface {
	Reset()
	FromMap(m map[string]interface{}) error
	ToMap() map[string]interface{}
	Init(cfg Configuration)
}

DynamicObject ...

type Element

type Element = *ElementT

Element ...

func (Element) FromMap

func (i Element) FromMap(m map[string]interface{}) error

FromMap ...

func (Element) GetColor

func (i Element) GetColor(value string) util.Color

GetColor ...

func (Element) Init added in v0.9.16

func (i Element) Init(cfg Configuration)

Init ...

func (Element) IsEnabled

func (i Element) IsEnabled() bool

IsEnabled ...

func (Element) MarshalYAML

func (i Element) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Element) PrintTo added in v1.0.3

func (i Element) PrintTo(color util.Color, builder *strings.Builder, a string)

PrintTo ...

func (Element) Reset

func (i Element) Reset()

Reset ...

func (Element) ToMap

func (i Element) ToMap() map[string]interface{}

ToMap ...

func (Element) UnmarshalYAML

func (i Element) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type ElementT

type ElementT struct {
	Color       util.Color
	Print       bool
	PrintFormat string `yaml:"print-format"`
}

ElementT ...

type Enum

type Enum = *EnumT

Enum ...

func (Enum) FromMap

func (i Enum) FromMap(m map[string]interface{}) error

FromMap ...

func (Enum) Init added in v0.9.16

func (i Enum) Init(cfg Configuration)

Init ...

func (Enum) MarshalYAML

func (i Enum) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Enum) Reset

func (i Enum) Reset()

Reset ...

func (Enum) ToMap

func (i Enum) ToMap() map[string]interface{}

ToMap ...

func (Enum) UnmarshalYAML

func (i Enum) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type EnumMap

type EnumMap = *EnumMapT

EnumMap ...

func (EnumMap) FromMap

func (i EnumMap) FromMap(m map[string]interface{}) error

FromMap ...

func (EnumMap) GetEnum

func (i EnumMap) GetEnum(value string) Enum

GetEnum ...

func (EnumMap) Init added in v0.9.16

func (i EnumMap) Init(cfg Configuration)

Init ...

func (EnumMap) IsEmpty

func (i EnumMap) IsEmpty() bool

IsEmpty ...

func (EnumMap) MarshalYAML

func (i EnumMap) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (EnumMap) Reset

func (i EnumMap) Reset()

Reset ...

func (EnumMap) ToMap

func (i EnumMap) ToMap() map[string]interface{}

ToMap ...

func (EnumMap) UnmarshalYAML

func (i EnumMap) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type EnumMapT

type EnumMapT struct {
	CaseSensitive bool `yaml:"case-sensitive"`
	Default       string
	// contains filtered or unexported fields
}

EnumMapT ...

type EnumT

type EnumT struct {
	Name  string
	Alias util.MultiString
	Color util.Color
}

EnumT ...

type Field

type Field = *FieldT

Field ...

func (Field) FromMap

func (i Field) FromMap(m map[string]interface{}) error

FromMap ...

func (Field) GetColor

func (i Field) GetColor(value string) util.Color

GetColor ...

func (Field) Init added in v0.9.16

func (i Field) Init(cfg Configuration)

Init ...

func (Field) IsEnum added in v0.9.17

func (i Field) IsEnum() bool

IsEnum ...

func (Field) MarshalYAML

func (i Field) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Field) Reset

func (i Field) Reset()

Reset ...

func (Field) ToMap

func (i Field) ToMap() map[string]interface{}

ToMap ...

func (Field) UnmarshalYAML

func (i Field) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type FieldMap

type FieldMap = *FieldMapT

FieldMap ...

func (FieldMap) FromMap

func (i FieldMap) FromMap(m map[string]interface{}) error

FromMap ...

func (FieldMap) Init added in v0.9.16

func (i FieldMap) Init(cfg Configuration)

Init ...

func (FieldMap) MarshalYAML

func (i FieldMap) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (FieldMap) Reset

func (i FieldMap) Reset()

Reset ...

func (FieldMap) ToMap

func (i FieldMap) ToMap() map[string]interface{}

ToMap ...

func (FieldMap) UnmarshalYAML

func (i FieldMap) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type FieldMapT

type FieldMapT struct {
	Others                  OtherFields
	StandardsWithAllAliases map[string]Field
	Standards               map[string]Field
}

FieldMapT ...

type FieldT

type FieldT struct {
	ElementT

	Name           string
	Alias          util.MultiString
	CaseSensitive  bool `yaml:"case-sensitive"`
	CompressPrefix `yaml:"compress-prefix"`
	Enums          EnumMap
	Type           FieldType
	TimeFormat     string `yaml:"time-format"`
	Timezone       string `yaml:"timezone"`
	TimeLocation   *time.Location
}

FieldT ...

type FieldType added in v0.9.12

type FieldType int

FieldType ...

const (
	// FieldTypeAuto ...
	FieldTypeAuto FieldType = iota

	// FieldTypeTime ...
	FieldTypeTime
)

type Grok added in v1.0.3

type Grok = *GrokT

Grok ...

func (Grok) FromMap added in v1.0.3

func (i Grok) FromMap(m map[string]interface{}) error

FromMap ...

func (Grok) Init added in v1.0.3

func (i Grok) Init(cfg Configuration)

Init ...

func (Grok) MarshalYAML added in v1.0.3

func (i Grok) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Grok) Parse added in v1.0.3

func (i Grok) Parse(pattern string, line string) (map[string]string, error)

Parse ...

func (Grok) Reset added in v1.0.3

func (i Grok) Reset()

Reset ...

func (Grok) ToMap added in v1.0.3

func (i Grok) ToMap() map[string]interface{}

ToMap ...

func (Grok) UnmarshalYAML added in v1.0.3

func (i Grok) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type GrokT added in v1.0.3

type GrokT struct {
	Uses          []string `yaml:"uses"`
	MatchesFields []string `yaml:"matches-fields"`
	LibraryDirs   []string `yaml:"library-dirs"`
	// contains filtered or unexported fields
}

GrokT ...

type OtherFields

type OtherFields = *OtherFieldsT

OtherFields ...

func (OtherFields) Reset

func (i OtherFields) Reset()

Reset ...

func (OtherFields) ToMap added in v0.9.3

func (i OtherFields) ToMap() map[string]interface{}

ToMap ...

type OtherFieldsT

type OtherFieldsT struct {
	Name      Element
	Separator SeparatorField
	Value     Element
}

OtherFieldsT ...

type Prefix

type Prefix = *PrefixT

Prefix ...

func (Prefix) FromMap

func (i Prefix) FromMap(m map[string]interface{}) error

FromMap ...

func (Prefix) MarshalYAML

func (i Prefix) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Prefix) Reset

func (i Prefix) Reset()

Reset ...

func (Prefix) ToMap

func (i Prefix) ToMap() map[string]interface{}

ToMap ...

func (Prefix) UnmarshalYAML

func (i Prefix) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type PrefixT

type PrefixT struct {
	ElementT
}

PrefixT ...

type SeparatorField

type SeparatorField = *SeparatorFieldT

SeparatorField ...

func (SeparatorField) FromMap

func (i SeparatorField) FromMap(m map[string]interface{}) error

FromMap ...

func (SeparatorField) MarshalYAML

func (i SeparatorField) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (SeparatorField) Reset

func (i SeparatorField) Reset()

Reset ...

func (SeparatorField) ToMap

func (i SeparatorField) ToMap() map[string]interface{}

ToMap ...

func (SeparatorField) UnmarshalYAML

func (i SeparatorField) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type SeparatorFieldT

type SeparatorFieldT struct {
	ElementT

	Label string
}

SeparatorFieldT ...

type StartupLine

type StartupLine = *StartupLineT

StartupLine ...

func (StartupLine) FromMap

func (i StartupLine) FromMap(m map[string]interface{}) error

FromMap ...

func (StartupLine) MarshalYAML

func (i StartupLine) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (StartupLine) Reset

func (i StartupLine) Reset()

Reset ...

func (StartupLine) ToMap

func (i StartupLine) ToMap() map[string]interface{}

ToMap ...

func (StartupLine) UnmarshalYAML

func (i StartupLine) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type StartupLineT

type StartupLineT struct {
	ElementT

	Contains string
}

StartupLineT ...

type StringSet added in v0.9.5

type StringSet = *StringSetT

StringSet ...

func (StringSet) Contains added in v0.9.5

func (i StringSet) Contains(v string) bool

Contains ...

func (StringSet) ContainsPrefixOf added in v0.9.6

func (i StringSet) ContainsPrefixOf(v string) bool

ContainsPrefixOf ...

func (StringSet) MarshalYAML added in v0.9.5

func (i StringSet) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (StringSet) Parse added in v0.9.5

func (i StringSet) Parse(input interface{})

Parse ...

func (StringSet) Reset added in v0.9.5

func (i StringSet) Reset()

Reset ...

func (StringSet) String added in v0.9.5

func (i StringSet) String() string

func (StringSet) UnmarshalYAML added in v0.9.5

func (i StringSet) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type StringSetT added in v0.9.5

type StringSetT struct {
	yaml.Unmarshaler
	yaml.Marshaler

	CaseSensitive      bool
	ValueMap           map[string]bool
	LowercasedValueMap map[string]bool
	UppercasedValueMap map[string]bool
}

StringSetT ...

Jump to

Keyboard shortcuts

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