Skip to content

Commit 36db058

Browse files
authored
Syslog output clarifications (#1377)
* Update tls info Signed-off-by: Joe Wakefield <[email protected]> * Update syslog_sd_key description Signed-off-by: Joe Wakefield <[email protected]> * Add yaml configuration examples Signed-off-by: Joe Wakefield <[email protected]> * Add SD auth token examples Signed-off-by: Joe Wakefield <[email protected]> * Fix TLS/SSL typo Signed-off-by: Joe Wakefield <[email protected]> * One sentences per line Signed-off-by: Joe Wakefield <[email protected]> --------- Signed-off-by: Joe Wakefield <[email protected]>
1 parent 22ba575 commit 36db058

File tree

1 file changed

+117
-4
lines changed

1 file changed

+117
-4
lines changed

pipeline/outputs/syslog.md

Lines changed: 117 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
The Syslog output plugin allows you to deliver messages to Syslog servers. It supports RFC3164 and RFC5424 formats through different transports such as UDP, TCP or TLS.
44

5-
As of Fluent Bit v1.5.3 the configuration is very strict. You must be aware of the structure of your original record so you can configure the plugin to use specific keys to compose your outgoing Syslog message.
5+
As of Fluent Bit v1.5.3 the configuration is very strict.
6+
You must be aware of the structure of your original record so you can configure the plugin to use specific keys to compose your outgoing Syslog message.
67

78
> Future versions of Fluent Bit are expanding this plugin feature set to support better handling of keys and message composing.
89
@@ -12,7 +13,7 @@ As of Fluent Bit v1.5.3 the configuration is very strict. You must be aware of t
1213
| :--- | :--- | :--- |
1314
| host | Domain or IP address of the remote Syslog server. | 127.0.0.1 |
1415
| port | TCP or UDP port of the remote Syslog server. | 514 |
15-
| mode | Desired transport type. Available options are `tcp`, `tls` and `udp`. | udp |
16+
| mode | Desired transport type. Available options are `tcp` and `udp`. | udp |
1617
| syslog\_format | The Syslog protocol format to use. Available options are `rfc3164` and `rfc5424`. | rfc5424 |
1718
| syslog\_maxsize | The maximum size allowed per message. The value must be an integer representing the number of bytes allowed. If no value is provided, the default size is set depending of the protocol version specified by `syslog_format`.<br><br>`rfc3164` sets max size to 1024 bytes.<br><br>`rfc5424` sets the size to 2048 bytes. | |
1819
| syslog\_severity\_key | The key name from the original record that contains the Syslog severity number. This configuration is optional. | |
@@ -27,16 +28,23 @@ As of Fluent Bit v1.5.3 the configuration is very strict. You must be aware of t
2728
| syslog\_procid\_preset | The preset process ID. It will be overwritten if `syslog_procid_key` is set and a key of a record is matched. This configuration is optional. | |
2829
| syslog\_msgid\_key | The key name from the original record that contains the Message ID associated to the message. This configuration is optional. | |
2930
| syslog\_msgid\_preset | The preset message ID. It will be overwritten if `syslog_msgid_key` is set and a key of a record is matched. This configuration is optional. | |
30-
| syslog\_sd\_key | The key name from the original record that contains the Structured Data \(SD\) content. This configuration is optional. | |
31+
| syslog\_sd\_key | The key name from the original record that contains a map of key/value pairs to use as Structured Data \(SD\) content. The key name is included in the resulting SD field as shown in examples below. This configuration is optional. | |
3132
| syslog\_message\_key | The key name from the original record that contains the message to deliver. Note that this property is **mandatory**, otherwise the message will be empty. | |
3233
| allow\_longer\_sd\_id| If true, Fluent-bit allows SD-ID that is longer than 32 characters. Such long SD-ID violates RFC 5424.| false |
3334

35+
### TLS / SSL
36+
37+
The Syslog output plugin supports TLS/SSL.
38+
For more details about the properties available and general configuration, please refer to the [TLS/SSL](../../administration/transport-security.md) section.
39+
3440
## Examples
3541

3642
### Configuration File
3743

3844
Get started quickly with this configuration file:
3945

46+
{% tabs %}
47+
{% tab title="fluent-bit.conf" %}
4048
```text
4149
[OUTPUT]
4250
name syslog
@@ -55,6 +63,28 @@ Get started quickly with this configuration file:
5563
syslog_sd_key sd
5664
syslog_message_key message
5765
```
66+
{% endtab %}
67+
{% tab title="fluent-bit.yaml" %}
68+
```yaml
69+
outputs:
70+
- name: syslog
71+
match: "*"
72+
host: syslog.yourserver.com
73+
port: 514
74+
mode: udp
75+
syslog_format: rfc5424
76+
syslog_maxsize: 2048
77+
syslog_severity_key: severity
78+
syslog_facility_key: facility
79+
syslog_hostname_key: hostname
80+
syslog_appname_key: appname
81+
syslog_procid_key: procid
82+
syslog_msgid_key: msgid
83+
syslog_sd_key: sd
84+
syslog_message_key: message
85+
```
86+
{% endtab %}
87+
{% endtabs %}
5888
5989
### Structured Data
6090
@@ -79,6 +109,8 @@ Example log:
79109

80110
Example configuration file:
81111

112+
{% tabs %}
113+
{% tab title="fluent-bit.conf" %}
82114
```text
83115
[OUTPUT]
84116
name syslog
@@ -95,9 +127,90 @@ Example configuration file:
95127
syslog_sd_key uls@0
96128
syslog_message_key log
97129
```
130+
{% endtab %}
131+
{% tab title="fluent-bit.yaml" %}
132+
```yaml
133+
outputs:
134+
- name: syslog
135+
match: "*"
136+
host: syslog.yourserver.com
137+
port: 514
138+
mode: udp
139+
syslog_format: rfc5424
140+
syslog_maxsize: 2048
141+
syslog_hostname_key: hostname
142+
syslog_appname_key: appname
143+
syslog_procid_key: procid
144+
syslog_msgid_key: msgid
145+
syslog_sd_key: uls@0
146+
syslog_message_key: log
147+
```
148+
{% endtab %}
149+
{% endtabs %}
98150

99151
Example output:
100152

101153
```bash
102154
<14>1 2021-07-12T14:37:35.569848Z myhost myapp 1234 ID98 [uls@0 logtype="access" clustername="mycluster" namespace="mynamespace"] Sample app log message.
103-
```
155+
```
156+
157+
### Adding Structured Data Authentication Token
158+
159+
Some services use the structured data field to pass authentication tokens (e.g. `[<token>@41018]`), which would need to be added to each log message dynamically.
160+
However, this requires setting the token as a key rather than as a value.
161+
Here's an example of how that might be achieved, using `AUTH_TOKEN` as a [variable](../../administration/configuring-fluent-bit/classic-mode/variables.md):
162+
163+
{% tabs %}
164+
{% tab title="fluent-bit.conf" %}
165+
```text
166+
[FILTER]
167+
name lua
168+
match *
169+
call append_token
170+
code function append_token(tag, timestamp, record) record["${AUTH_TOKEN}"] = {} return 2, timestamp, record end
171+
172+
[OUTPUT]
173+
name syslog
174+
match *
175+
host syslog.yourserver.com
176+
port 514
177+
mode tcp
178+
syslog_format rfc5424
179+
syslog_hostname_preset my-hostname
180+
syslog_appname_preset my-appname
181+
syslog_message_key log
182+
allow_longer_sd_id true
183+
syslog_sd_key ${AUTH_TOKEN}
184+
tls on
185+
tls.crt_file /path/to/my.crt
186+
```
187+
{% endtab %}
188+
{% tab title="fluent-bit.yaml" %}
189+
```yaml
190+
filters:
191+
- name: lua
192+
match: "*"
193+
call: append_token
194+
code: |
195+
function append_token(tag, timestamp, record)
196+
record["${AUTH_TOKEN}"] = {}
197+
return 2, timestamp, record
198+
end
199+
200+
outputs:
201+
- name: syslog
202+
match: "*"
203+
host: syslog.yourserver.com
204+
port: 514
205+
mode: tcp
206+
syslog_format: rfc5424
207+
syslog_hostname_preset: myhost
208+
syslog_appname_preset: myapp
209+
syslog_message_key: log
210+
allow_longer_sd_id: true
211+
syslog_sd_key: ${AUTH_TOKEN}
212+
tls: on
213+
tls.crt_file: /path/to/my.crt
214+
```
215+
{% endtab %}
216+
{% endtabs %}

0 commit comments

Comments
 (0)