Log Forwarding to Nagios Log Server R2 on CentOS 7


Nagios Log Server R2 introduces a revamped logging system, making it easier to centralize and analyze logs from various sources. This guide will walk you through setting up a CentOS 7 machine to send its logs to the Nagios Log Server R2 using both automatic and manual methods.
Getting Started
After setup, logs that would typically appear in /var/log/messages
will be forwarded to the Nagios Log Server R2, allowing centralized monitoring and alerting.
Automatic Setup Using a Script
The easiest way to configure log forwarding is by using the provided script. This method requires rsyslog
to be installed on your CentOS 7 machine.
Steps to Run the Script:
- Ensure Rsyslog is Installed:
sudo yum install rsyslog -y
sudo systemctl enable --now rsyslog
- Download the Script from the Nagios Log Server R2:
curl -sS -O http://192.168.1.49/nagioslogserver/scripts/setup-linux.sh
- Execute the Script to Configure Rsyslog:
sudo bash setup-linux.sh -s 192.168.1.49 -p 5544
- Replace
192.168.1.49
with your Nagios Log Server R2’s IP address. - The
-p 5544
option specifies the port for log transmission.
Manual Setup Using Rsyslog Configuration
If you prefer manual setup or need more control over configurations, follow these steps:
- Edit Rsyslog Configuration:
<code>sudo nano /etc/rsyslog.d/99-nagios.conf
2. Add the following configuration:
*.* @@192.168.1.49:5544
- Replace
192.168.1.49
with the IP address of your Nagios Log Server R2. - The
@@
symbol indicates TCP transmission; use@
for UDP if needed.
- Restart Rsyslog to Apply Changes:
sudo systemctl restart rsyslog<br>
- Check Status to Ensure it’s Running:
sudo systemctl status rsyslog<br>
Receiving Logs in Log Server
On your Log Server’s GUI, click Add Log Source.

Click Linux.

Type in your machine’s IP address to see if you are receiving logs. If it’s working, the interface will confirm that logs are being received.

Conclusion
Whether using the automatic script or manual setup, forwarding logs from CentOS 7 to Nagios Log Server R2 ensures centralized log management for better monitoring and alerting. Use the method that best fits your deployment needs.