Skip to content

Commit da22f5e

Browse files
authored
Merge pull request #931 from sjliu1/syslog
[summerospp]add fluentbit syslog plugin
2 parents 33e09d2 + ed46fdd commit da22f5e

File tree

10 files changed

+395
-0
lines changed

10 files changed

+395
-0
lines changed

apis/fluentbit/v1alpha2/clusterinput_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ type InputSpec struct {
6767
StatsD *input.StatsD `json:"statsd,omitempty"`
6868
// Nginx defines the Nginx input plugin configuration
6969
Nginx *input.Nginx `json:"nginx,omitempty"`
70+
// Syslog defines the Syslog input plugin configuration
71+
Syslog *input.Syslog `json:"syslog,omitempty"`
7072
}
7173

7274
// +kubebuilder:object:root=true
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package input
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins"
7+
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params"
8+
)
9+
10+
// +kubebuilder:object:generate:=true
11+
12+
// Syslog input plugins allows to collect Syslog messages through a Unix socket server (UDP or TCP) or over the network using TCP or UDP. <br />
13+
// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/syslog**
14+
type Syslog struct {
15+
// Defines transport protocol mode: unix_udp (UDP over Unix socket), unix_tcp (TCP over Unix socket), tcp or udp
16+
// +kubebuilder:validation:Enum:=unix_udp;unix_tcp;tcp;udp
17+
Mode string `json:"mode,omitempty"`
18+
// If Mode is set to tcp or udp, specify the network interface to bind, default: 0.0.0.0
19+
Listen string `json:"listen,omitempty"`
20+
// If Mode is set to tcp or udp, specify the TCP port to listen for incoming connections.
21+
// +kubebuilder:validation:Minimum:=1
22+
// +kubebuilder:validation:Maximum:=65535
23+
Port *int32 `json:"port,omitempty"`
24+
// If Mode is set to unix_tcp or unix_udp, set the absolute path to the Unix socket file.
25+
Path string `json:"path,omitempty"`
26+
// If Mode is set to unix_tcp or unix_udp, set the permission of the Unix socket file, default: 0644
27+
UnixPerm *int32 `json:"unixPerm,omitempty"`
28+
// 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.
29+
// If your syslog messages have fractional seconds set this Parser value to syslog-rfc5424 instead.
30+
Parser string `json:"parser,omitempty"`
31+
// By default the buffer to store the incoming Syslog messages, do not allocate the maximum memory allowed, instead it allocate memory when is required.
32+
//The rounds of allocations are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size is equal to 32000 bytes (32KB).
33+
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
34+
BufferChunkSize string `json:"bufferChunkSize,omitempty"`
35+
// Specify the maximum buffer size to receive a Syslog message. If not set, the default size will be the value of Buffer_Chunk_Size.
36+
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
37+
BufferMaxSize string `json:"bufferMaxSize,omitempty"`
38+
// Specify the maximum socket receive buffer size. If not set, the default value is OS-dependant,
39+
// 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.
40+
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$"
41+
ReceiveBufferSize string `json:"receiveBufferSize,omitempty"`
42+
// Specify the key where the source address will be injected.
43+
SourceAddressKey string `json:"sourceAddressKey,omitempty"`
44+
}
45+
46+
func (_ *Syslog) Name() string {
47+
return "syslog"
48+
}
49+
50+
func (s *Syslog) Params(_ plugins.SecretLoader) (*params.KVs, error) {
51+
kvs := params.NewKVs()
52+
53+
if s.Mode != "" {
54+
kvs.Insert("Mode", s.Path)
55+
}
56+
if s.Listen != "" {
57+
kvs.Insert("Listen", s.Path)
58+
}
59+
if s.Port != nil {
60+
kvs.Insert("Port", fmt.Sprint(*s.Port))
61+
}
62+
if s.Path != "" {
63+
kvs.Insert("Path", s.Path)
64+
}
65+
if s.UnixPerm != nil {
66+
kvs.Insert("Unix_Perm", fmt.Sprint(*s.UnixPerm))
67+
}
68+
if s.Parser != "" {
69+
kvs.Insert("Parser", s.Parser)
70+
}
71+
if s.BufferChunkSize != "" {
72+
kvs.Insert("Buffer_Chunk_Size", s.BufferChunkSize)
73+
}
74+
if s.BufferMaxSize != "" {
75+
kvs.Insert("Buffer_Max_Size", s.BufferChunkSize)
76+
}
77+
if s.ReceiveBufferSize != "" {
78+
kvs.Insert("Receive_Buffer_Size", s.ReceiveBufferSize)
79+
}
80+
if s.SourceAddressKey != "" {
81+
kvs.Insert("Source_Address_Key", s.SourceAddressKey)
82+
}
83+
84+
return kvs, nil
85+
}

apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterinputs.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,71 @@ spec:
389389
minimum: 1
390390
type: integer
391391
type: object
392+
syslog:
393+
description: Syslog defines the Syslog input plugin configuration
394+
properties:
395+
bufferChunkSize:
396+
description: By default the buffer to store the incoming Syslog
397+
messages, do not allocate the maximum memory allowed, instead
398+
it allocate memory when is required. The rounds of allocations
399+
are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size
400+
is equal to 32000 bytes (32KB).
401+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
402+
type: string
403+
bufferMaxSize:
404+
description: Specify the maximum buffer size to receive a Syslog
405+
message. If not set, the default size will be the value of Buffer_Chunk_Size.
406+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
407+
type: string
408+
listen:
409+
description: 'If Mode is set to tcp or udp, specify the network
410+
interface to bind, default: 0.0.0.0'
411+
type: string
412+
mode:
413+
description: 'Defines transport protocol mode: unix_udp (UDP over
414+
Unix socket), unix_tcp (TCP over Unix socket), tcp or udp'
415+
enum:
416+
- unix_udp
417+
- unix_tcp
418+
- tcp
419+
- udp
420+
type: string
421+
parser:
422+
description: Specify an alternative parser for the message. If
423+
Mode is set to tcp or udp then the default parser is syslog-rfc5424
424+
otherwise syslog-rfc3164-local is used. If your syslog messages
425+
have fractional seconds set this Parser value to syslog-rfc5424
426+
instead.
427+
type: string
428+
path:
429+
description: If Mode is set to unix_tcp or unix_udp, set the absolute
430+
path to the Unix socket file.
431+
type: string
432+
port:
433+
description: If Mode is set to tcp or udp, specify the TCP port
434+
to listen for incoming connections.
435+
format: int32
436+
maximum: 65535
437+
minimum: 1
438+
type: integer
439+
receiveBufferSize:
440+
description: Specify the maximum socket receive buffer size. If
441+
not set, the default value is OS-dependant, but generally too
442+
low to accept thousands of syslog messages per second without
443+
loss on udp or unix_udp sockets. Note that on Linux the value
444+
is capped by sysctl net.core.rmem_max.
445+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
446+
type: string
447+
sourceAddressKey:
448+
description: Specify the key where the source address will be
449+
injected.
450+
type: string
451+
unixPerm:
452+
description: 'If Mode is set to unix_tcp or unix_udp, set the
453+
permission of the Unix socket file, default: 0644'
454+
format: int32
455+
type: integer
456+
type: object
392457
systemd:
393458
description: Systemd defines Systemd Input configuration.
394459
properties:

config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,71 @@ spec:
389389
minimum: 1
390390
type: integer
391391
type: object
392+
syslog:
393+
description: Syslog defines the Syslog input plugin configuration
394+
properties:
395+
bufferChunkSize:
396+
description: By default the buffer to store the incoming Syslog
397+
messages, do not allocate the maximum memory allowed, instead
398+
it allocate memory when is required. The rounds of allocations
399+
are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size
400+
is equal to 32000 bytes (32KB).
401+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
402+
type: string
403+
bufferMaxSize:
404+
description: Specify the maximum buffer size to receive a Syslog
405+
message. If not set, the default size will be the value of Buffer_Chunk_Size.
406+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
407+
type: string
408+
listen:
409+
description: 'If Mode is set to tcp or udp, specify the network
410+
interface to bind, default: 0.0.0.0'
411+
type: string
412+
mode:
413+
description: 'Defines transport protocol mode: unix_udp (UDP over
414+
Unix socket), unix_tcp (TCP over Unix socket), tcp or udp'
415+
enum:
416+
- unix_udp
417+
- unix_tcp
418+
- tcp
419+
- udp
420+
type: string
421+
parser:
422+
description: Specify an alternative parser for the message. If
423+
Mode is set to tcp or udp then the default parser is syslog-rfc5424
424+
otherwise syslog-rfc3164-local is used. If your syslog messages
425+
have fractional seconds set this Parser value to syslog-rfc5424
426+
instead.
427+
type: string
428+
path:
429+
description: If Mode is set to unix_tcp or unix_udp, set the absolute
430+
path to the Unix socket file.
431+
type: string
432+
port:
433+
description: If Mode is set to tcp or udp, specify the TCP port
434+
to listen for incoming connections.
435+
format: int32
436+
maximum: 65535
437+
minimum: 1
438+
type: integer
439+
receiveBufferSize:
440+
description: Specify the maximum socket receive buffer size. If
441+
not set, the default value is OS-dependant, but generally too
442+
low to accept thousands of syslog messages per second without
443+
loss on udp or unix_udp sockets. Note that on Linux the value
444+
is capped by sysctl net.core.rmem_max.
445+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
446+
type: string
447+
sourceAddressKey:
448+
description: Specify the key where the source address will be
449+
injected.
450+
type: string
451+
unixPerm:
452+
description: 'If Mode is set to unix_tcp or unix_udp, set the
453+
permission of the Unix socket file, default: 0644'
454+
format: int32
455+
type: integer
456+
type: object
392457
systemd:
393458
description: Systemd defines Systemd Input configuration.
394459
properties:

docs/fluentbit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ InputSpec defines the desired state of ClusterInput
426426
| collectd | Collectd defines the Collectd input plugin configuration | *[input.Collectd](plugins/input/collectd.md) |
427427
| statsd | StatsD defines the StatsD input plugin configuration | *[input.StatsD](plugins/input/statsd.md) |
428428
| nginx | Nginx defines the Nginx input plugin configuration | *[input.Nginx](plugins/input/nginx.md) |
429+
| syslog | Syslog defines the Syslog input plugin configuration | *[input.Syslog](plugins/input/syslog.md) |
429430

430431
[Back to TOC](#table-of-contents)
431432
# NamespacedFluentBitCfgSpec
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Syslog
2+
3+
Syslog input plugins allows to collect Syslog messages through a Unix socket server (UDP or TCP) or over the network using TCP or UDP. <br /> **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/syslog**
4+
5+
6+
| Field | Description | Scheme |
7+
| ----- | ----------- | ------ |
8+
| mode | Defines transport protocol mode: unix_udp (UDP over Unix socket), unix_tcp (TCP over Unix socket), tcp or udp | string |
9+
| listen | If Mode is set to tcp or udp, specify the network interface to bind, default: 0.0.0.0 | string |
10+
| port | If Mode is set to tcp or udp, specify the TCP port to listen for incoming connections. | *int32 |
11+
| path | If Mode is set to unix_tcp or unix_udp, set the absolute path to the Unix socket file. | string |
12+
| unixPerm | If Mode is set to unix_tcp or unix_udp, set the permission of the Unix socket file, default: 0644 | *int32 |
13+
| 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 |
14+
| 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 |
15+
| 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 |
16+
| 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 |
17+
| sourceAddressKey | Specify the key where the source address will be injected. | string |

manifests/setup/fluent-operator-crd.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,71 @@ spec:
21382138
minimum: 1
21392139
type: integer
21402140
type: object
2141+
syslog:
2142+
description: Syslog defines the Syslog input plugin configuration
2143+
properties:
2144+
bufferChunkSize:
2145+
description: By default the buffer to store the incoming Syslog
2146+
messages, do not allocate the maximum memory allowed, instead
2147+
it allocate memory when is required. The rounds of allocations
2148+
are set by Buffer_Chunk_Size. If not set, Buffer_Chunk_Size
2149+
is equal to 32000 bytes (32KB).
2150+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
2151+
type: string
2152+
bufferMaxSize:
2153+
description: Specify the maximum buffer size to receive a Syslog
2154+
message. If not set, the default size will be the value of Buffer_Chunk_Size.
2155+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
2156+
type: string
2157+
listen:
2158+
description: 'If Mode is set to tcp or udp, specify the network
2159+
interface to bind, default: 0.0.0.0'
2160+
type: string
2161+
mode:
2162+
description: 'Defines transport protocol mode: unix_udp (UDP over
2163+
Unix socket), unix_tcp (TCP over Unix socket), tcp or udp'
2164+
enum:
2165+
- unix_udp
2166+
- unix_tcp
2167+
- tcp
2168+
- udp
2169+
type: string
2170+
parser:
2171+
description: Specify an alternative parser for the message. If
2172+
Mode is set to tcp or udp then the default parser is syslog-rfc5424
2173+
otherwise syslog-rfc3164-local is used. If your syslog messages
2174+
have fractional seconds set this Parser value to syslog-rfc5424
2175+
instead.
2176+
type: string
2177+
path:
2178+
description: If Mode is set to unix_tcp or unix_udp, set the absolute
2179+
path to the Unix socket file.
2180+
type: string
2181+
port:
2182+
description: If Mode is set to tcp or udp, specify the TCP port
2183+
to listen for incoming connections.
2184+
format: int32
2185+
maximum: 65535
2186+
minimum: 1
2187+
type: integer
2188+
receiveBufferSize:
2189+
description: Specify the maximum socket receive buffer size. If
2190+
not set, the default value is OS-dependant, but generally too
2191+
low to accept thousands of syslog messages per second without
2192+
loss on udp or unix_udp sockets. Note that on Linux the value
2193+
is capped by sysctl net.core.rmem_max.
2194+
pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$
2195+
type: string
2196+
sourceAddressKey:
2197+
description: Specify the key where the source address will be
2198+
injected.
2199+
type: string
2200+
unixPerm:
2201+
description: 'If Mode is set to unix_tcp or unix_udp, set the
2202+
permission of the Unix socket file, default: 0644'
2203+
format: int32
2204+
type: integer
2205+
type: object
21412206
systemd:
21422207
description: Systemd defines Systemd Input configuration.
21432208
properties:

0 commit comments

Comments
 (0)