Syslog Server Setup
In this section, we’ll cover how to set up a Syslog server and configure clients to send logs to that server. We’ll focus on the widely used Syslog implementations: rsyslog and syslog-ng on Linux. We’ll also discuss Syslog configuration on network devices like Cisco routers and switches.
Syslog Server Setup

Syslog Server Setup
Setting Up a Syslog Server Using rsyslog
Rsyslog is one of the most popular Syslog daemons due to its high performance, flexibility, and advanced features like reliable message delivery, support for various input/output modules, and log filtering. It’s the default Syslog daemon in many Linux distributions.
Step 1: Installing rsyslog
On most Linux distributions, rsyslog is pre-installed. However, if it’s not, you can install it using the package manager:
On Ubuntu or Debian:
sudo apt update
sudo apt install rsyslog
On CentOS or RHEL:
sudo yum install rsyslog
Syslog Server Setup
Step 2: Configuring rsyslog as a Syslog Server
By default, rsyslog listens for log messages on the local system. To configure it to accept logs from remote systems, follow these steps:
Enable UDP or TCP Reception: In the rsyslog configuration file (/etc/rsyslog.conf), uncomment the following lines to enable UDP and/or TCP reception:
For UDP (faster but less reliable):
# Provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
For TCP (more reliable but slightly slower):
# Provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
Configure Log Storage: You can customize where logs are stored based on the type of device or client. For example, to store logs from different hosts in separate directories:
$template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
*.* ?RemoteLogs
This setup ensures that each client’s logs are stored in a subdirectory named after the client’s hostname, and logs from different programs on that client will be separated into different files.
Restart the rsyslog Service: After making the changes, restart the rsyslog service:
sudo systemctl restart rsyslog
Open Firewall for Syslog Traffic: Ensure the firewall is configured to allow Syslog traffic on the appropriate port (UDP or TCP 514):
sudo ufw allow 514/tcp
sudo ufw allow 514/udp
Syslog Server Setup
Setting Up a Syslog Server Using syslog-ng
syslog-ng is another popular Syslog implementation, known for its flexibility and extensive filtering options. It can act as both a Syslog server and client, collecting logs from various sources and forwarding them to other destinations.
Step 1: Installing syslog-ng
On Ubuntu or Debian:
sudo apt update
sudo apt install syslog-ng
On CentOS or RHEL:
sudo yum install syslog-ng
Syslog Server Setup
Step 2: Configuring syslog-ng as a Syslog Server
Configure UDP and TCP Reception: In the syslog-ng configuration file (/etc/syslog-ng/syslog-ng.conf), add the following lines to configure the server to accept UDP or TCP logs:
For UDP:
source s_net_udp {
udp(ip("0.0.0.0") port(514));
};
For TCP:
source s_net_tcp {
tcp(ip("0.0.0.0") port(514));
};
Configure Log Storage: Similar to rsyslog, you can store logs based on the source host:
destination d_hosts {
file("/var/log/syslog-ng/$HOST/$YEAR-$MONTH-$DAY.log");
};
Apply the Configuration: Restart the syslog-ng service to apply the changes:
sudo systemctl restart syslog-ng
Open Firewall for Syslog Traffic: Ensure the firewall is configured to allow Syslog traffic on the appropriate port (UDP or TCP 514):
sudo ufw allow 514/tcp
sudo ufw allow 514/udp
Syslog Server Setup
Configuring Syslog on Linux Clients
To configure a Linux client to send logs to a remote Syslog server, you can modify the rsyslog configuration.
Open the rsyslog Configuration File: Edit the configuration file /etc/rsyslog.conf on the client machine:
sudo nano /etc/rsyslog.conf
Add the Syslog Server Address: Add a line specifying the remote Syslog server’s IP address. For example:
For UDP:
*.* @192.168.1.100:514
For TCP:
*.* @@192.168.1.100:514
In this configuration:
*.* means all facilities and severities.
The single @ means send via UDP; double @@ means send via TCP.
Restart the rsyslog Service: After saving the changes, restart rsyslog:
sudo systemctl restart rsyslog
The client will now send all logs to the remote Syslog server.
Syslog Server Setup
Configuring Syslog on Cisco Routers and Switches
Syslog is also widely supported on network devices like Cisco routers and switches. Configuring Syslog on Cisco devices is relatively straightforward.
Step 1: Enable Logging to a Remote Syslog Server
Enter Global Configuration Mode:
enable
configure terminal
Set the Syslog Server IP: Use the logging command to specify the remote Syslog server’s IP address:
logging 192.168.1.100
Specify the Severity Level: You can choose which severity levels to send. For example, to send logs of severity level 5 (notifications) and higher:
logging trap notifications
Configure Timestamps: Timestamps help ensure accurate log records. Enable timestamping with the following command:
service timestamps log datetime msec
Enable Log Source IP: It’s a good practice to log the IP address of the interface sending the logs:
logging source-interface GigabitEthernet0/1
Save Configuration: After configuring Syslog, save the settings:
write memory
Syslog Server Setup
Advanced Use Cases for Syslog
Integration with Security Information and Event Management (SIEM): Many organizations integrate Syslog with SIEM solutions like Splunk, Graylog, or ELK Stack to collect, analyze, and correlate log data for security, compliance, and operational intelligence. SIEM platforms enhance the capability of Syslog by providing real-time alerting, advanced search, and reporting features.
Monitoring Network Devices: Syslog is essential in monitoring network devices like routers, switches, and firewalls. For example, by using Syslog with SNMP traps, administrators can detect network outages, device failures, or configuration changes in real-time.
Application Logging: Syslog isn’t limited to system and network logs. Many applications (e.g., Apache, Nginx, MySQL) can be configured to send logs to Syslog, allowing for centralized log management across the entire infrastructure.
Centralized Logging for Hybrid Cloud Environments: In hybrid cloud environments, Syslog can centralize logs from both on-premises and cloud-based resources. Cloud platforms like AWS, Azure, and Google Cloud can forward logs to a Syslog server for unified log management and compliance.
Syslog Server Setup
Summary
Syslog is a robust and flexible logging solution widely used across various industries for centralizing logs from different devices, applications, and systems. Setting up a Syslog server using tools like rsyslog or syslog-ng provides administrators with real-time insights, enabling better monitoring, troubleshooting, and security auditing.
While Syslog has some limitations, such as the lack of encryption and reliability when using UDP, it can be enhanced with additional protocols like Syslog over TLS or by integrating with SIEM systems for more advanced log analysis.
By configuring Syslog on Linux servers, network devices, and even in cloud environments, organizations can improve their operational visibility and streamline their log management practices.
Syslog Server Setup
Useful Links
https://datatracker.ietf.org/doc/html/rfc5424
https://sanchitgurukul.com/tutorials-cat
Syslog Server Setup
Ultimate Syslog Server Setup: A Step-by-Step Guide to Seamless Logging
This article provided insights on the topic. For latest updates and detailed guides, stay connected with Sanchit Gurukul.
