diff --git a/apis/fluentbit/v1alpha2/clusterinput_types.go b/apis/fluentbit/v1alpha2/clusterinput_types.go index b46c64add..450e9d625 100644 --- a/apis/fluentbit/v1alpha2/clusterinput_types.go +++ b/apis/fluentbit/v1alpha2/clusterinput_types.go @@ -67,6 +67,8 @@ type InputSpec struct { StatsD *input.StatsD `json:"statsd,omitempty"` // Nginx defines the Nginx input plugin configuration Nginx *input.Nginx `json:"nginx,omitempty"` + // Syslog defines the Syslog input plugin configuration + Syslog *input.Syslog `json:"syslog,omitempty"` } // +kubebuilder:object:root=true diff --git a/apis/fluentbit/v1alpha2/plugins/input/syslog.go b/apis/fluentbit/v1alpha2/plugins/input/syslog.go new file mode 100644 index 000000000..4597d9a7a --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/input/syslog.go @@ -0,0 +1,85 @@ +package input + +import ( + "fmt" + + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins" + "github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params" +) + +// +kubebuilder:object:generate:=true + +// Syslog input plugins allows to collect Syslog messages through a Unix socket server (UDP or TCP) or over the network using TCP or UDP.
+// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/syslog** +type Syslog struct { + // Defines transport protocol mode: unix_udp (UDP over Unix socket), unix_tcp (TCP over Unix socket), tcp or udp + // +kubebuilder:validation:Enum:=unix_udp;unix_tcp;tcp;udp + Mode string `json:"mode,omitempty"` + // If Mode is set to tcp or udp, specify the network interface to bind, default: 0.0.0.0 + Listen string `json:"listen,omitempty"` + // If Mode is set to tcp or udp, specify the TCP port to listen for incoming connections. + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=65535 + Port *int32 `json:"port,omitempty"` + // If Mode is set to unix_tcp or unix_udp, set the absolute path to the Unix socket file. + Path string `json:"path,omitempty"` + // If Mode is set to unix_tcp or unix_udp, set the permission of the Unix socket file, default: 0644 + UnixPerm *int32 `json:"unixPerm,omitempty"` + // Specify an alternative parser for the message. If Mode is set to tcp or udp then the default parser is syslog-rfc5424 otherwise syslog-rfc3164-local is used. + // If your syslog messages have fractional seconds set this Parser value to syslog-rfc5424 instead. + Parser string `json:"parser,omitempty"` + // By default the buffer to store the incoming Syslog messages, do not allocate the maximum memory allowed, instead it allocate memory when is required. + //The rounds of allocations are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size is equal to 32000 bytes (32KB). + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferChunkSize string `json:"bufferChunkSize,omitempty"` + // Specify the maximum buffer size to receive a Syslog message. If not set, the default size will be the value of Buffer_Chunk_Size. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferMaxSize string `json:"bufferMaxSize,omitempty"` + // Specify the maximum socket receive buffer size. If not set, the default value is OS-dependant, + // but generally too low to accept thousands of syslog messages per second without loss on udp or unix_udp sockets. Note that on Linux the value is capped by sysctl net.core.rmem_max. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + ReceiveBufferSize string `json:"receiveBufferSize,omitempty"` + // Specify the key where the source address will be injected. + SourceAddressKey string `json:"sourceAddressKey,omitempty"` +} + +func (_ *Syslog) Name() string { + return "syslog" +} + +func (s *Syslog) Params(_ plugins.SecretLoader) (*params.KVs, error) { + kvs := params.NewKVs() + + if s.Mode != "" { + kvs.Insert("Mode", s.Path) + } + if s.Listen != "" { + kvs.Insert("Listen", s.Path) + } + if s.Port != nil { + kvs.Insert("Port", fmt.Sprint(*s.Port)) + } + if s.Path != "" { + kvs.Insert("Path", s.Path) + } + if s.UnixPerm != nil { + kvs.Insert("Unix_Perm", fmt.Sprint(*s.UnixPerm)) + } + if s.Parser != "" { + kvs.Insert("Parser", s.Parser) + } + if s.BufferChunkSize != "" { + kvs.Insert("Buffer_Chunk_Size", s.BufferChunkSize) + } + if s.BufferMaxSize != "" { + kvs.Insert("Buffer_Max_Size", s.BufferChunkSize) + } + if s.ReceiveBufferSize != "" { + kvs.Insert("Receive_Buffer_Size", s.ReceiveBufferSize) + } + if s.SourceAddressKey != "" { + kvs.Insert("Source_Address_Key", s.SourceAddressKey) + } + + return kvs, nil +} diff --git a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go index f44227c8f..8342ce0e7 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go @@ -275,6 +275,31 @@ func (in *StatsD) DeepCopy() *StatsD { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Syslog) DeepCopyInto(out *Syslog) { + *out = *in + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.UnixPerm != nil { + in, out := &in.UnixPerm, &out.UnixPerm + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Syslog. +func (in *Syslog) DeepCopy() *Syslog { + if in == nil { + return nil + } + out := new(Syslog) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Systemd) DeepCopyInto(out *Systemd) { *out = *in diff --git a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go index e98f814ef..caf372a94 100644 --- a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go @@ -1108,6 +1108,11 @@ func (in *InputSpec) DeepCopyInto(out *InputSpec) { *out = new(input.Nginx) (*in).DeepCopyInto(*out) } + if in.Syslog != nil { + in, out := &in.Syslog, &out.Syslog + *out = new(input.Syslog) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputSpec. diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml index 307e47687..5759ea7b2 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml @@ -389,6 +389,71 @@ spec: minimum: 1 type: integer type: object + syslog: + description: Syslog defines the Syslog input plugin configuration + properties: + bufferChunkSize: + description: By default the buffer to store the incoming Syslog + messages, do not allocate the maximum memory allowed, instead + it allocate memory when is required. The rounds of allocations + are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size + is equal to 32000 bytes (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size to receive a Syslog + message. If not set, the default size will be the value of Buffer_Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: 'If Mode is set to tcp or udp, specify the network + interface to bind, default: 0.0.0.0' + type: string + mode: + description: 'Defines transport protocol mode: unix_udp (UDP over + Unix socket), unix_tcp (TCP over Unix socket), tcp or udp' + enum: + - unix_udp + - unix_tcp + - tcp + - udp + type: string + parser: + description: Specify an alternative parser for the message. If + Mode is set to tcp or udp then the default parser is syslog-rfc5424 + otherwise syslog-rfc3164-local is used. If your syslog messages + have fractional seconds set this Parser value to syslog-rfc5424 + instead. + type: string + path: + description: If Mode is set to unix_tcp or unix_udp, set the absolute + path to the Unix socket file. + type: string + port: + description: If Mode is set to tcp or udp, specify the TCP port + to listen for incoming connections. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + receiveBufferSize: + description: Specify the maximum socket receive buffer size. If + not set, the default value is OS-dependant, but generally too + low to accept thousands of syslog messages per second without + loss on udp or unix_udp sockets. Note that on Linux the value + is capped by sysctl net.core.rmem_max. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + sourceAddressKey: + description: Specify the key where the source address will be + injected. + type: string + unixPerm: + description: 'If Mode is set to unix_tcp or unix_udp, set the + permission of the Unix socket file, default: 0644' + format: int32 + type: integer + type: object systemd: description: Systemd defines Systemd Input configuration. properties: diff --git a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml index 307e47687..5759ea7b2 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml @@ -389,6 +389,71 @@ spec: minimum: 1 type: integer type: object + syslog: + description: Syslog defines the Syslog input plugin configuration + properties: + bufferChunkSize: + description: By default the buffer to store the incoming Syslog + messages, do not allocate the maximum memory allowed, instead + it allocate memory when is required. The rounds of allocations + are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size + is equal to 32000 bytes (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size to receive a Syslog + message. If not set, the default size will be the value of Buffer_Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: 'If Mode is set to tcp or udp, specify the network + interface to bind, default: 0.0.0.0' + type: string + mode: + description: 'Defines transport protocol mode: unix_udp (UDP over + Unix socket), unix_tcp (TCP over Unix socket), tcp or udp' + enum: + - unix_udp + - unix_tcp + - tcp + - udp + type: string + parser: + description: Specify an alternative parser for the message. If + Mode is set to tcp or udp then the default parser is syslog-rfc5424 + otherwise syslog-rfc3164-local is used. If your syslog messages + have fractional seconds set this Parser value to syslog-rfc5424 + instead. + type: string + path: + description: If Mode is set to unix_tcp or unix_udp, set the absolute + path to the Unix socket file. + type: string + port: + description: If Mode is set to tcp or udp, specify the TCP port + to listen for incoming connections. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + receiveBufferSize: + description: Specify the maximum socket receive buffer size. If + not set, the default value is OS-dependant, but generally too + low to accept thousands of syslog messages per second without + loss on udp or unix_udp sockets. Note that on Linux the value + is capped by sysctl net.core.rmem_max. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + sourceAddressKey: + description: Specify the key where the source address will be + injected. + type: string + unixPerm: + description: 'If Mode is set to unix_tcp or unix_udp, set the + permission of the Unix socket file, default: 0644' + format: int32 + type: integer + type: object systemd: description: Systemd defines Systemd Input configuration. properties: diff --git a/docs/fluentbit.md b/docs/fluentbit.md index 3b86bfbbb..cf6a37991 100644 --- a/docs/fluentbit.md +++ b/docs/fluentbit.md @@ -426,6 +426,7 @@ InputSpec defines the desired state of ClusterInput | collectd | Collectd defines the Collectd input plugin configuration | *[input.Collectd](plugins/input/collectd.md) | | statsd | StatsD defines the StatsD input plugin configuration | *[input.StatsD](plugins/input/statsd.md) | | nginx | Nginx defines the Nginx input plugin configuration | *[input.Nginx](plugins/input/nginx.md) | +| syslog | Syslog defines the Syslog input plugin configuration | *[input.Syslog](plugins/input/syslog.md) | [Back to TOC](#table-of-contents) # NamespacedFluentBitCfgSpec diff --git a/docs/plugins/fluentbit/input/syslog.md b/docs/plugins/fluentbit/input/syslog.md new file mode 100644 index 000000000..861dd3a71 --- /dev/null +++ b/docs/plugins/fluentbit/input/syslog.md @@ -0,0 +1,17 @@ +# Syslog + +Syslog input plugins allows to collect Syslog messages through a Unix socket server (UDP or TCP) or over the network using TCP or UDP.
**For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/syslog** + + +| Field | Description | Scheme | +| ----- | ----------- | ------ | +| mode | Defines transport protocol mode: unix_udp (UDP over Unix socket), unix_tcp (TCP over Unix socket), tcp or udp | string | +| listen | If Mode is set to tcp or udp, specify the network interface to bind, default: 0.0.0.0 | string | +| port | If Mode is set to tcp or udp, specify the TCP port to listen for incoming connections. | *int32 | +| path | If Mode is set to unix_tcp or unix_udp, set the absolute path to the Unix socket file. | string | +| unixPerm | If Mode is set to unix_tcp or unix_udp, set the permission of the Unix socket file, default: 0644 | *int32 | +| parser | Specify an alternative parser for the message. If Mode is set to tcp or udp then the default parser is syslog-rfc5424 otherwise syslog-rfc3164-local is used. If your syslog messages have fractional seconds set this Parser value to syslog-rfc5424 instead. | string | +| bufferChunkSize | By default the buffer to store the incoming Syslog messages, do not allocate the maximum memory allowed, instead it allocate memory when is required. The rounds of allocations are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size is equal to 32000 bytes (32KB). | string | +| bufferMaxSize | Specify the maximum buffer size to receive a Syslog message. If not set, the default size will be the value of Buffer_Chunk_Size. | string | +| receiveBufferSize | Specify the maximum socket receive buffer size. If not set, the default value is OS-dependant, but generally too low to accept thousands of syslog messages per second without loss on udp or unix_udp sockets. Note that on Linux the value is capped by sysctl net.core.rmem_max. | string | +| sourceAddressKey | Specify the key where the source address will be injected. | string | diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 69a2f3bee..251d3efb1 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -2138,6 +2138,71 @@ spec: minimum: 1 type: integer type: object + syslog: + description: Syslog defines the Syslog input plugin configuration + properties: + bufferChunkSize: + description: By default the buffer to store the incoming Syslog + messages, do not allocate the maximum memory allowed, instead + it allocate memory when is required. The rounds of allocations + are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size + is equal to 32000 bytes (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size to receive a Syslog + message. If not set, the default size will be the value of Buffer_Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: 'If Mode is set to tcp or udp, specify the network + interface to bind, default: 0.0.0.0' + type: string + mode: + description: 'Defines transport protocol mode: unix_udp (UDP over + Unix socket), unix_tcp (TCP over Unix socket), tcp or udp' + enum: + - unix_udp + - unix_tcp + - tcp + - udp + type: string + parser: + description: Specify an alternative parser for the message. If + Mode is set to tcp or udp then the default parser is syslog-rfc5424 + otherwise syslog-rfc3164-local is used. If your syslog messages + have fractional seconds set this Parser value to syslog-rfc5424 + instead. + type: string + path: + description: If Mode is set to unix_tcp or unix_udp, set the absolute + path to the Unix socket file. + type: string + port: + description: If Mode is set to tcp or udp, specify the TCP port + to listen for incoming connections. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + receiveBufferSize: + description: Specify the maximum socket receive buffer size. If + not set, the default value is OS-dependant, but generally too + low to accept thousands of syslog messages per second without + loss on udp or unix_udp sockets. Note that on Linux the value + is capped by sysctl net.core.rmem_max. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + sourceAddressKey: + description: Specify the key where the source address will be + injected. + type: string + unixPerm: + description: 'If Mode is set to unix_tcp or unix_udp, set the + permission of the Unix socket file, default: 0644' + format: int32 + type: integer + type: object systemd: description: Systemd defines Systemd Input configuration. properties: diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 4a08c1171..ad965f276 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -2138,6 +2138,71 @@ spec: minimum: 1 type: integer type: object + syslog: + description: Syslog defines the Syslog input plugin configuration + properties: + bufferChunkSize: + description: By default the buffer to store the incoming Syslog + messages, do not allocate the maximum memory allowed, instead + it allocate memory when is required. The rounds of allocations + are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size + is equal to 32000 bytes (32KB). + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Specify the maximum buffer size to receive a Syslog + message. If not set, the default size will be the value of Buffer_Chunk_Size. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: 'If Mode is set to tcp or udp, specify the network + interface to bind, default: 0.0.0.0' + type: string + mode: + description: 'Defines transport protocol mode: unix_udp (UDP over + Unix socket), unix_tcp (TCP over Unix socket), tcp or udp' + enum: + - unix_udp + - unix_tcp + - tcp + - udp + type: string + parser: + description: Specify an alternative parser for the message. If + Mode is set to tcp or udp then the default parser is syslog-rfc5424 + otherwise syslog-rfc3164-local is used. If your syslog messages + have fractional seconds set this Parser value to syslog-rfc5424 + instead. + type: string + path: + description: If Mode is set to unix_tcp or unix_udp, set the absolute + path to the Unix socket file. + type: string + port: + description: If Mode is set to tcp or udp, specify the TCP port + to listen for incoming connections. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + receiveBufferSize: + description: Specify the maximum socket receive buffer size. If + not set, the default value is OS-dependant, but generally too + low to accept thousands of syslog messages per second without + loss on udp or unix_udp sockets. Note that on Linux the value + is capped by sysctl net.core.rmem_max. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + sourceAddressKey: + description: Specify the key where the source address will be + injected. + type: string + unixPerm: + description: 'If Mode is set to unix_tcp or unix_udp, set the + permission of the Unix socket file, default: 0644' + format: int32 + type: integer + type: object systemd: description: Systemd defines Systemd Input configuration. properties: