Documentation
¶
Overview ¶
Example (ConfigWithProcessors) ¶
conf := Config{
Pipeline: Pipeline{
Inputs: Plugins{
Plugin{
Properties: property.Properties{
{Key: "name", Value: "dummy"},
{Key: "processors", Value: property.Properties{
{Key: "logs", Value: Plugins{
Plugin{
Properties: property.Properties{
{Key: "name", Value: "calyptia"},
{Key: "actions", Value: property.Properties{
{Key: "type", Value: "block_keys"},
{Key: "opts", Value: property.Properties{
{Key: "regex", Value: "star"},
{Key: "regexEngine", Value: "pcre2"},
}},
}},
},
},
}},
}},
},
},
},
},
}
yaml, err := conf.DumpAsYAML()
if err != nil {
panic(err)
}
fmt.Println(yaml)
Output: pipeline: inputs: - name: dummy processors: logs: - name: calyptia actions: type: block_keys opts: regex: star regexEngine: pcre2
Index ¶
- Constants
- Variables
- func Name(props property.Properties) string
- func ValidateSection(kind SectionKind, props property.Properties) error
- func ValidateSectionWithSchema(kind SectionKind, props property.Properties, schema Schema) error
- type Config
- func (c *Config) AddSection(kind SectionKind, props property.Properties)
- func (c Config) DumpAs(format Format) (string, error)
- func (c Config) DumpAsClassic() (string, error)
- func (c Config) DumpAsJSON() (string, error)
- func (c Config) DumpAsYAML() (string, error)
- func (c Config) Equal(target Config) bool
- func (c Config) FindByID(id string) (Plugin, bool)
- func (c Config) IDs(namespaced bool) []string
- func (c *Config) Include(path string)
- func (c Config) MarshalClassic() ([]byte, error)
- func (c *Config) ServicePorts() ServicePorts
- func (c *Config) SetEnv(key string, value any)
- func (c *Config) UnmarshalClassic(text []byte) error
- func (c Config) Validate() error
- func (c Config) ValidateWithSchema(schema Schema) error
- type Format
- type LinedError
- type Pipeline
- type Plugin
- type Plugins
- type Schema
- type SchemaFluentBit
- type SchemaOptionList
- type SchemaOptions
- type SchemaProperties
- type SchemaSection
- type SectionKind
- type ServicePort
- type ServicePortGetter
- type ServicePorts
- type UnknownPluginError
Examples ¶
Constants ¶
View Source
const ( FormatClassic = "classic" FormatYAML = "yaml" FormatJSON = "json" )
Variables ¶
View Source
var DefaultSchema = func() Schema { var s Schema err := json.Unmarshal(rawSchema, &s) if err != nil { fmt.Fprintf(os.Stderr, "could not parse fluent-bit schema: %v\n", err) os.Exit(1) } s.InjectLTSPlugins() return s }()
View Source
var ErrFormatUnknown = errors.New("format unknown")
View Source
var ErrMissingName = errors.New("missing name property")
Functions ¶
func ValidateSection ¶
func ValidateSection(kind SectionKind, props property.Properties) error
func ValidateSectionWithSchema ¶
func ValidateSectionWithSchema(kind SectionKind, props property.Properties, schema Schema) error
Types ¶
type Config ¶
type Config struct {
Env property.Properties `json:"env,omitempty" yaml:"env,omitempty"`
Includes []string `json:"includes,omitempty" yaml:"includes,omitempty"`
Service property.Properties `json:"service,omitempty" yaml:"service,omitempty"`
Customs Plugins `json:"customs,omitempty" yaml:"customs,omitempty"`
Pipeline Pipeline `json:"pipeline,omitempty" yaml:"pipeline,omitempty"`
Parsers Plugins `json:"parsers,omitempty" yaml:"parsers,omitempty"`
}
func ParseAsClassic ¶ added in v2.3.1
func ParseAsJSON ¶ added in v2.3.1
func ParseAsYAML ¶ added in v2.3.1
func (*Config) AddSection ¶
func (c *Config) AddSection(kind SectionKind, props property.Properties)
func (Config) DumpAsClassic ¶
func (Config) DumpAsJSON ¶
func (Config) DumpAsYAML ¶
func (Config) FindByID ¶
FindByID were the id should be namespaced with the section kind and name. For example: input:tail:tail.0
func (Config) MarshalClassic ¶
func (*Config) ServicePorts ¶
func (c *Config) ServicePorts() ServicePorts
func (*Config) UnmarshalClassic ¶
func (Config) ValidateWithSchema ¶
ValidateWithSchema validates that the config satisfies all properties defined on the schema. That is if the schema says the the input plugin "cpu" has a property named "pid" that is of integer type, it must be a valid integer.
type LinedError ¶
LinedError with information about the line number where the error was found while parsing.
func NewLinedError ¶
func NewLinedError(msg string, line uint) *LinedError
func WrapLinedError ¶
func WrapLinedError(err error, line uint) *LinedError
func (*LinedError) Error ¶
func (e *LinedError) Error() string
type Plugin ¶
type Plugin struct {
ID string `json:"-" yaml:"-"`
Name string `json:"-" yaml:"-"`
Properties property.Properties `json:",inline" yaml:",inline"`
}
func (Plugin) MarshalJSON ¶
func (Plugin) MarshalYAML ¶
func (*Plugin) UnmarshalJSON ¶
type Plugins ¶
type Plugins []Plugin
func (*Plugins) UnmarshalJSON ¶
type Schema ¶
type Schema struct {
FluentBit SchemaFluentBit `json:"fluent-bit"`
Customs []SchemaSection `json:"customs"`
Inputs []SchemaSection `json:"inputs"`
Filters []SchemaSection `json:"filters"`
Outputs []SchemaSection `json:"outputs"`
Processors []SchemaSection `json:"processors"`
}
func (*Schema) InjectLTSPlugins ¶
func (s *Schema) InjectLTSPlugins()
type SchemaFluentBit ¶
type SchemaOptionList ¶ added in v2.13.0
type SchemaOptionList []SchemaOptions
func (SchemaOptionList) FindOption ¶ added in v2.13.0
func (options SchemaOptionList) FindOption(optname string) *SchemaOptions
type SchemaOptions ¶
type SchemaOptions struct {
Name string `json:"name"`
Description string `json:"description"`
Default any `json:"default,omitempty"`
Type string `json:"type"`
Options SchemaOptionList `json:"options,omitempty"`
}
type SchemaProperties ¶
type SchemaProperties struct {
Options []SchemaOptions `json:"options"`
// GlobalOptions only appear on inputs.
GlobalOptions []SchemaOptions `json:"global_options"`
// Networking is only present in outputs.
Networking []SchemaOptions `json:"networking"`
// NetworkTLS is only present in outputs.
NetworkTLS []SchemaOptions `json:"network_tls"`
}
type SchemaSection ¶
type SchemaSection struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Properties SchemaProperties `json:"properties"`
}
type SectionKind ¶
type SectionKind string
const ( SectionKindService SectionKind = "service" SectionKindCustom SectionKind = "custom" SectionKindInput SectionKind = "input" SectionKindParser SectionKind = "parser" SectionKindFilter SectionKind = "filter" SectionKindOutput SectionKind = "output" SectionKindProcessor SectionKind = "processor" )
func (SectionKind) String ¶
func (k SectionKind) String() string
type ServicePort ¶
type ServicePort struct {
Port int32
Protocol networking.Protocol
Kind SectionKind
// Plugin is not available for `service“ section kind.
Plugin *Plugin
}
type ServicePortGetter ¶ added in v2.5.0
type ServicePorts ¶
type ServicePorts []ServicePort
type UnknownPluginError ¶ added in v2.1.0
type UnknownPluginError struct {
Kind SectionKind
Name string
}
func NewUnknownPluginError ¶ added in v2.1.0
func NewUnknownPluginError(kind SectionKind, name string) *UnknownPluginError
func (*UnknownPluginError) Error ¶ added in v2.1.0
func (e *UnknownPluginError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.