Skip to content
How to send syslog from Linux systems into Graylog
Branch: master
Clone or download
nagstaku and bernd Update readme (#9)
some systems only monitors .conf files -- helpful hint added to readme for such users
Latest commit 1af3b75 Nov 6, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Nov 30, 2015
README.md Update readme (#9) Nov 6, 2018

README.md

Sending syslog from Linux systems into Graylog

The two most popular syslog deamons (the programs that run in the background to accept and write or forward logs) are rsyslog and syslog-ng. One of these will most likely be running on your Linux distribution.

Please refer to the documentation of your distribution if you are not sure about this.

⚠️ Warning ⚠️

These instructions configure rsyslog and syslog-ng to send log messages unencrypted over the network. This is generally not recommended on public networks.

rsyslog

Forwarding syslog messages with rsyslog is easy. The only important thing to get the most out of your logs is following RFC 5424. The following examples configure your rsyslog daemon to send RFC 5424 date to Graylog syslog inputs:

UDP:
*.* @graylog.example.org:514;RSYSLOG_SyslogProtocol23Format
TCP:
*.* @@graylog.example.org:514;RSYSLOG_SyslogProtocol23Format

(The difference between UDP and TCP is using @ instead of @@ as target descriptor.)

The above configuration should be placed as new file ending in .conf in /etc/rsyslog.d/ and rsyslog should be restarted. In addition the port 514 on the Graylog server need to be reachable from the sending server.

Old rsyslog

If you're using a very old version of rsyslog (versions before rsyslog 5.10) which doesn't provide the built-in RSYSLOG_SyslogProtocol23Format template, you can create a custom message template.

For UDP this becomes:

$template GRAYLOGRFC5424,"<%PRI%>%PROTOCOL-VERSION% %TIMESTAMP:::date-rfc3339% %HOSTNAME% %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% %msg%\n"
*.* @graylog.example.org:514;GRAYLOGRFC5424

syslog-ng

Configuring syslog-ng to send syslog to Graylog is equally simple. Use the syslog function to send RFC 5424 formatted syslog messages via TCP to the remote Graylog host:

# Define TCP syslog destination.
destination d_net {
    syslog("graylog.example.org" port(514));
};
# Tell syslog-ng to send data from source s_src to the newly defined syslog destination.
log {
    source(s_src); # Defined in the default syslog-ng configuration.
    destination(d_net);
};
You can’t perform that action at this time.