-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syslog input plugin #4181
Syslog input plugin #4181
Changes from 1 commit
c1b7de8
c802954
1507ea4
f17171e
1bb3907
e4f70f4
a805e38
b2647ed
1c27f07
09f869b
dd6c6c0
6ca6e91
8da1f80
e0e9d40
716da76
625d18b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# syslog input plugin | ||
|
||
Collects syslog messages as per RFC5425 or RFC5426. | ||
|
||
It can act as a syslog transport receiver over TLS (or TCP) - ie., RFC5425 - or over UDP - ie., RFC5426. | ||
|
||
This plugin listens for syslog messages following RFC5424 format. When received it parses them extracting metrics. | ||
|
||
### Configuration: | ||
|
||
#### TCP | ||
|
||
The minimal configuration is the following: | ||
|
||
```toml | ||
[[inputs.syslog]] | ||
address = ":6514" | ||
``` | ||
|
||
This starts this plugins as a syslog receiver over TCP protocol on port 6514. | ||
|
||
#### TLS | ||
|
||
To configure it as a TLS syslog receiver as recommended by RFC5425 give it the following configuration: | ||
|
||
```toml | ||
[[inputs.syslog]] | ||
address = ":6514" | ||
tls_cacert = "/etc/telegraf/ca.pem" | ||
tls_cert = "/etc/telegraf/cert.pem" | ||
tls_key = "/etc/telegraf/key.pem" | ||
``` | ||
|
||
#### UDP | ||
|
||
To configure this plugin as per RFC5426 give it the following configuration: | ||
|
||
```toml | ||
[[inputs.syslog]] | ||
protocol = "udp" | ||
address = ":6514" | ||
``` | ||
|
||
#### Other configs | ||
|
||
Other available configurations are: | ||
|
||
- `keep_alive_period`, `max_connections` for stream sockets | ||
- `best_effort` to tell the parser to work until it is able to do and extract partial but valid info | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add more details on how this works or add link to go-syslog repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
|
||
### Metrics | ||
|
||
- syslog | ||
- fields | ||
- **version** (`uint16`) | ||
- timestamp (`time.Time`) | ||
- procid (`string`) | ||
- msgid (`string`) | ||
- _structureddata element id_ (`bool`) | ||
- _structureddata element parameter name_ (`string`) | ||
- tags | ||
- **severity** (`string`) | ||
- **severity_level** (`string`) | ||
- **facility** (`string`) | ||
- **facility_message** (`string`) | ||
- hostname (`string`) | ||
- appname (`string`) | ||
|
||
The name of fields in _italic_ corresponds to their runtime value. | ||
|
||
The fields/tags which name is in **bold** will always be present when a valid Syslog message has been received. | ||
|
||
### Syslog transport sender | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Title this section something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
|
||
The following instructions illustrate how to configure a syslog transport sender as per RFC5425 - ie., using the octect framing technique. | ||
|
||
Install `rsyslog`. | ||
|
||
Give it a configuration - ie., `/etc/rsyslog.conf`. | ||
|
||
``` | ||
$ModLoad imuxsock # provides support for local system logging | ||
$ModLoad imklog # provides kernel logging support | ||
$ModLoad immark # provides heart-beat logs | ||
$FileOwner root | ||
$FileGroup root | ||
$FileCreateMode 0640 | ||
$DirCreateMode 0755 | ||
$Umask 0022 | ||
$WorkDirectory /var/spool/rsyslog # default location for work (spool) files | ||
$ActionQueueType LinkedList # use asynchronous processing | ||
$ActionQueueFileName srvrfwd # set file name, also enables disk mode | ||
$ActionResumeRetryCount -1 # infinite retries on insert failure | ||
$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down | ||
$IncludeConfig /etc/rsyslog.d/*.conf | ||
``` | ||
|
||
Specify you want the octet framing technique enabled and the format of each syslog message to follow the RFC5424. | ||
|
||
Create a file - eg., `/etc/rsyslog.d/50-default.conf` - containing: | ||
|
||
``` | ||
*.* @@(o)127.0.0.1:6514;RSYSLOG_SyslogProtocol23Format | ||
``` | ||
|
||
To complete the TLS setup please refer to [rsyslog docs](https://www.rsyslog.com/doc/v8-stable/tutorials/tls.html). | ||
|
||
Notice that this configuration tells `rsyslog` to broadcast messages to `127.0.0.1>6514`. | ||
|
||
So you have to configure this plugin accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have a single configuration, no need to show it in multiple potential configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, what configuration should we show? The minimal one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done showing the config for TLS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run
telegraf -usage syslog
and use the output.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.