Skip to content

Graylog2/graylog-guide-syslog-linux

master
Switch branches/tags
Code

Latest commit

some systems only monitors .conf files -- helpful hint added to readme for such users
1af3b75

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

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);
};

About

How to send syslog from Linux systems into Graylog

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •