fluentbit

package module
v0.0.0-...-3f4a631 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

CI && Documentation

Go Documentation CI/Unit Tests

fluentbit-go

GO bindings for fluentbit.

Usage

sudo apt install td-agent-bit-headers td-agent-bit

Building

CGO checks has to be disabled before building any integration.

GODEBUG=cgocheck=0 go build 

Documentation

Index

Constants

View Source
const (
	LibError       = int(C.FLB_LIB_ERROR)
	LibNone        = int(C.FLB_LIB_NONE)
	LibOK          = int(C.FLB_LIB_OK)
	LibNoConfigMap = int(C.FLB_LIB_NO_CONFIG_MAP)
)

enum possible return values from the library

Variables

View Source
var ConfigMapOpts = ConfigMapOptsT{
	"input": {
		"disk": []string{
			"interval_sec",
			"interval_nsec",
			"dev_name",
		},
		"health": []string{
			"interval_sec",
			"interval_nsec",
			"alert",
			"add_host",
			"add_port",
		},
		"storage_backlog": []string{
			"tag",
			"log_level",
			"routable",
			"alias",
			"mem_buf_limit",
			"listen",
			"host",
			"port",
			"ipv6",
			"storage.type",
			"filesystem",
			"memory",
		},
		"cpu": []string{
			"pid",
			"interval_sec",
			"interval_nsec",
		},
		"lib": []string{
			"tag",
			"log_level",
			"routable",
			"alias",
			"mem_buf_limit",
			"listen",
			"host",
			"port",
			"ipv6",
			"storage.type",
			"filesystem",
			"memory",
		},
		"proc": []string{
			"interval_sec",
			"interval_nsec",
			"alert",
			"mem",
			"fd",
			"proc_name",
		},
		"thermal": []string{
			"interval_sec",
			"interval_nsec",
			"name_regex",
			"type_regex",
		},
		"forward": []string{
			"unix_path",
			"buffer_chunk_size",
			"buffer_max_size",
		},
		"random": []string{
			"samples",
			"interval_sec",
			"interval_nsec",
		},
		"serial": []string{
			"file",
			"bitrate",
			"separator",
			"format",
			"min_bytes",
		},
		"mem": []string{
			"interval_sec",
			"pid",
		},
		"exec": []string{
			"command",
			"parser",
			"buf_size",
			"interval_sec",
			"interval_nsec",
			"oneshot",
		},
		"syslog": []string{
			"mode",
			"path",
			"unix_perm",
			"buffer_chunk_size",
			"buffer_max_size",
			"parser",
		},
		"kmsg": []string{
			"tag",
			"log_level",
			"routable",
			"alias",
			"mem_buf_limit",
			"listen",
			"host",
			"port",
			"ipv6",
			"storage.type",
			"filesystem",
			"memory",
		},
		"docker": []string{
			"interval_sec",
		},
		"statsd": []string{
			"tag",
			"log_level",
			"routable",
			"alias",
			"mem_buf_limit",
			"listen",
			"host",
			"port",
			"ipv6",
			"storage.type",
			"filesystem",
			"memory",
		},
		"systemd": []string{
			"path",
			"db.sync",
			"db",
			"max_fields",
			"max_entries",
			"systemd_filter_type",
			"read_from_tail",
			"strip_underscores",
		},
		"head": []string{
			"file",
			"key",
			"buf_size",
			"interval_sec",
			"interval_nsec",
			"split_line",
			"lines",
			"add_path",
		},
		"tcp": []string{
			"format",
			"separator",
			"chunk_size",
			"buffer_size",
		},
		"collectd": []string{
			"typesdb",
		},
		"stdin": []string{
			"parser",
			"buffer_size",
		},
		"stream_processor": []string{
			"tag",
			"log_level",
			"routable",
			"alias",
			"mem_buf_limit",
			"listen",
			"host",
			"port",
			"ipv6",
			"storage.type",
			"filesystem",
			"memory",
		},
		"netif": []string{
			"interval_sec",
			"interval_nsec",
			"verbose",
			"interface",
		},
		"emitter": []string{
			"tag",
			"log_level",
			"routable",
			"alias",
			"mem_buf_limit",
			"listen",
			"host",
			"port",
			"ipv6",
			"storage.type",
			"filesystem",
			"memory",
		},
	},
	"output": {
		"plot": []string{
			"key",
			"file",
		},
		"datadog": []string{
			"proxy",
			"apikey",
			"include_tag_key",
			"tag_key",
			"dd_source",
			"dd_service",
			"dd_tags",
			"dd_message_key",
			"provider",
			"json_date_key",
			"compress",
		},
		"influxdb": []string{
			"database",
			"bucket",
			"org",
			"sequence_tag",
			"http_user",
			"http_passwd",
			"http_token",
			"auto_tags",
			"tag_keys",
		},
		"null": []string{
			"match",
			"match_regex",
			"log_level",
			"host",
			"port",
			"ipv6",
			"retry_limit",
			"tls",
			"tls.*",
			"storage.*",
			"workers",
			"net.*",
			"_debug.http.*",
		},
		"lib": []string{
			"format",
			"max_records",
		},
		"retry": []string{
			"retries",
		},
		"counter": []string{
			"match",
			"match_regex",
			"log_level",
			"host",
			"port",
			"ipv6",
			"retry_limit",
			"tls",
			"tls.*",
			"storage.*",
			"workers",
			"net.*",
			"_debug.http.*",
		},
		"gelf": []string{
			"mode",
			"gelf_timestamp_key",
			"gelf_host_key",
			"gelf_short_message_key",
			"gelf_full_message_key",
			"gelf_level_key",
			"packet_size",
			"compress",
		},
		"pgsql": []string{
			"database",
			"table",
			"user",
			"password",
			"timestamp_key",
			"max_pool_size",
			"min_pool_size",
			"async",
			"cockroachdb",
		},
		"bigquery": []string{
			"google_service_credentials",
			"service_account_email",
			"service_account_secret",
			"project_id",
			"dataset_id",
			"table_id",
		},
		"kafka": []string{
			"brokers",
			"topic_key",
			"dynamic_topic",
			"format",
			"message_key",
			"message_key_field",
			"timestamp_key",
			"timestamp_format",
			"queue_full_retries",
			"gelf_timestamp_key",
			"gelf_host_key",
			"gelf_short_message_key",
			"gelf_full_message_key",
			"gelf_level_key",
			"schema_str",
			"schema_id",
			"topics",
		},
		"nats": []string{
			"match",
			"match_regex",
			"log_level",
			"host",
			"port",
			"ipv6",
			"retry_limit",
			"tls",
			"tls.*",
			"storage.*",
			"workers",
			"net.*",
			"_debug.http.*",
		},
		"stackdriver": []string{
			"metadata_server",
			"google_service_credentials",
			"service_account_email",
			"service_account_secret",
			"export_to_project_id",
			"resource",
			"severity_key",
			"autoformat_stackdriver_trace",
			"trace_key",
			"log_name_key",
			"k8s_cluster_name",
			"k8s_cluster_location",
			"location",
			"namespace",
			"node_id",
			"job",
			"task_id",
			"labels_key",
			"tag_prefix",
		},
		"td": []string{
			"API",
			"Database ",
			"Table",
			"region",
		},
		"azure": []string{
			"customer_id",
			"shared_key",
			"log_type",
			"time_key",
		},
	},
	"filter": {
		"nest": []string{
			"match_regex",
			"operation",
			"wildcard",
			"nest_under",
			"nested_under",
			"add_prefix",
			"remove_prefix",
			"match",
			"alias",
			"log_level",
		},
		"modify": []string{
			"set",
			"add",
			"remove",
			"remove_wildcard",
			"remove_regex",
			"rename",
			"hard_rename",
			"copy",
			"hard_copy",
			"condition",
			"match",
			"alias",
			"log_level",
		},
		"geoip2": []string{
			"database",
			"lookup_key",
			"record",
			"match",
			"alias",
			"log_level",
		},
		"stdout": []string{
			"match_regex",
			"match",
			"format",
			"json_date_key",
			"json_date_format",
			"alias",
			"log_level",
		},
		"throttle": []string{
			"rate",
			"window",
			"print_status",
			"interval",
			"log_field",
			"name_field",
			"window_time_duration",
			"hash_table_size",
		},
		"throttle_size": []string{
			"rate",
			"window",
			"print_status",
			"interval",
			"log_field",
			"name_field",
			"window_time_duration",
			"hash_table_size",
		},
		"parser": []string{
			"key_name",
			"parser",
			"reserve_data",
			"preserve_key",
			"unescape_key",
		},
		"grep": []string{
			"match_regex",
			"match",
			"alias",
			"log_level",
			"exclude",
			"regex",
		},
		"lua": []string{
			"script",
			"call",
			"type_int_key",
			"protected_mode",
			"time_as_table",
		},
		"record_modifier": []string{
			"remove_key",
			"record",
			"allowlist_key",
			"whitelist_key",
			"remove_key",
			"match_regex",
			"match",
			"alias",
			"log_level",
		},
	},
}
View Source
var DefaultOpts = DefaultOptsT{
	"input": {
		"mode", "tag", "log_level", "routable", "alias", "mem_buf_limit", "listen", "host", "port", "ipv6", "storage.type", "filesystem", "memory",
	},
	"output": {
		"match", "match_regex", "log_level", "host", "port", "ipv6", "retry_limit", "tls", "tls.*", "storage.*", "workers", "net.*", "_debug.http.*", "rdkafka.*",
	},
	"filter": {
		"match", "match_regex", "alias", "log_level",
	},
}

Functions

func ConfigOptionLookup

func ConfigOptionLookup(pluginType, pluginName, optName string) bool

Types

type ConfigMapOptsT

type ConfigMapOptsT map[string]map[string][]string

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context structure to save the fluentbit context

func NewContext

func NewContext(opts *Options) (*Context, error)

NewContext Returns a C.struct_flb_lib_ctx

func (*Context) Destroy

func (c *Context) Destroy()

Destroy removes the reference to C.struct_flb_lib_ctx

func (*Context) Filter

func (c *Context) Filter(name string) (*Filter, error)

Filter constructor of flb_filter

func (*Context) Input

func (c *Context) Input(name string) (*Input, error)

Input constructor of flb_input

func (*Context) LibConfigFile

func (c *Context) LibConfigFile(path string) int

LibConfigFile Opens a config using flb_lib_config_file

func (*Context) LibPush

func (c *Context) LibPush(input *Input, msg string) int

LibPush Pushes a new message using C.flb_lib_push

func (*Context) Loop

func (c *Context) Loop() int

Loop maps to flb_loop

func (*Context) Output

func (c *Context) Output(name string, callback func(val string)) (*Output, error)

Output constructor, received a name and a callback (function)

func (*Context) ServiceSet

func (c *Context) ServiceSet(opt, val string) int

ServiceSet Sets an option, val in the service using flb_service_set

func (*Context) Start

func (c *Context) Start() int

Start maps to flb_start

func (*Context) Stop

func (c *Context) Stop() int

Stop maps to flb_stop

type DefaultOptsT

type DefaultOptsT map[string][]string

type Filter

type Filter struct {
	Int        int
	FilterType string
	// contains filtered or unexported fields
}

Filter structure to map filter ffd

func NewFilter

func NewFilter(context *C.struct_flb_lib_ctx, name string) (*Filter, error)

func (*Filter) SetOpts

func (f *Filter) SetOpts(opts *Options) ([]error, error)

SetOpts Set a map[string]string of options using flb_filter_set

type Input

type Input struct {
	Int       int
	InputType string
	// contains filtered or unexported fields
}

Input structure to map input ffd

func NewInput

func NewInput(context *C.struct_flb_lib_ctx, name string) (*Input, error)

func (*Input) SetOpts

func (i *Input) SetOpts(opts *Options) ([]error, error)

SetOpts Set a map[string]string of options using flb_input_set

type Options

type Options map[string]string

type Output

type Output struct {
	Int        int
	OutputType string
	// contains filtered or unexported fields
}

Output structure to map output ffd

func NewOutput

func NewOutput(context *C.struct_flb_lib_ctx, name string, callback *C.struct_flb_lib_out_cb) (*Output, error)

func (*Output) SetOpts

func (o *Output) SetOpts(opts *Options) ([]error, error)

SetOpts Set a map[string]string as options using flb_output_set

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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