Log Forwarding to Nagios Log Server R2 on CentOS 7

Picture of Tucker Falen
Tucker Falen
log

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:

  1. Ensure Rsyslog is Installed:
sudo yum install rsyslog -y
sudo systemctl enable --now rsyslog
  1. Download the Script from the Nagios Log Server R2:
curl -sS -O http://192.168.1.49/nagioslogserver/scripts/setup-linux.sh
  1. 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:

  1. 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.
  1. Restart Rsyslog to Apply Changes:
sudo systemctl restart rsyslog<br>
  1. 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.

Screenshot 2025 03 21 131259 1
Nagios Log Server home page

Click Linux.

Screenshot 2025 03 21 131443 1
Add log source

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.

Screenshot 2025 03 21 132800 1
Verify incoming logs

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.

Share: