Syslog Configurations - savannahc502/SavC-TechJournal-SEC350 GitHub Wiki
Steps to set up a syslog server (on CentOS) and client for centralized logging
-
Network Configuration:
- Change Network Adapter to the appropriate network.
- Set the hostname
sudo hostnamectl set-hostname <hostname>
- Set static IP using a network management tool (e.g., nmtui):
- IP Address:
- Gateway/DNS:
-
User Setup:
- Change the root password
passwd root
- Add a new sudo user
- Change the root password
sudo adduser <username>
sudo usermod -aG wheel <username>
- Restart Network
sudo systemctl restart network
- Install and Enable rsyslog
sudo yum install -y rsyslog
sudo systemctl enable --now rsyslog
sudo systemctl status rsyslog
- Configure Firewall
sudo firewall-cmd --permanent --add-port=514/udp
sudo firewall-cmd --permanent --add-port=514/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
- Modify rsyslog Configuration:
- Edit /etc/rsyslog.conf to receive syslog messages over ports 514:
sudo nano /etc/rsyslog.conf
- Uncomment the lines for TCP and UDP.
- Restart rsyslog service:
sudo systemctl restart rsyslog
- Verify rsyslog Listening
sudo netstat -tupan | grep 514
-
Network Configuration:
- Change Network Adapter to the appropriate network.
- Set the hostname
sudo hostnamectl set-hostname <hostname>
- Set static IP using a network management tool (e.g., nmtui):
- IP Address:
- Gateway/DNS:
-
User Setup:
- Change the root password
passwd root
- Add a new sudo user
- Change the root password
sudo adduser <username>
sudo usermod -aG wheel <username>
- Restart Network
sudo systemctl restart network
- Install and Enable rsyslog
sudo yum install -y rsyslog
sudo systemctl enable --now rsyslog
sudo systemctl status rsyslog
- Create rsyslog Configuration
- Create
/etc/rsyslog.d/<config file>:
- Create
sudo nano /etc/rsyslog.d/<config file>
- Add the following line to send syslog messages to the syslog server:
user.notice @<server IP>
- Restart rsyslog service:
sudo systemctl restart rsyslog
- Test Syslog Messaging
- On the syslog server, monitor the log messages:
sudo tail -f /var/log/messages
- On the syslog client, send a test syslog message:
logger -t test "Test message from client to server"