In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to configure Rsyslog server in CentOS8. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
Configure a Rsyslog server on CentOS 8
By default, Rsyslog is installed on a CentOS 8 / RHEL 8 server. To verify the status of Rsyslog, log in through SSH and run the following command:
$systemctl status rsyslog
Sample output:
Rsyslog-service-status-centos8
If for some reason Rsyslog does not exist, you can install it using the following command:
$sudo yum install rsyslog
Next, you need to modify some settings in the Rsyslog configuration file. Open the configuration file:
$sudo vim / etc/rsyslog.conf
Scroll and uncomment the following line to allow logs to be received through the UDP protocol:
Module (load= "imudp") # needs to be done just onceinput (type= "imudp" port= "514")
Rsyslog-conf-centos8-rhel8
Similarly, if you want to enable TCP rsyslog reception, uncomment the following line:
Module (load= "imtcp") # needs to be done just onceinput (type= "imtcp" port= "514")
Rsyslog-conf-tcp-centos8-rhel8
Save and exit the configuration file.
To receive logs from the client system, we need to open Rsyslog default port 514 on the firewall. To do this, run:
# sudo firewall-cmd-add-port=514/tcp-zone=public-permanent
Next, reload the firewall to save the changes:
# sudo firewall-cmd-reload
Sample output:
Firewall-ports-rsyslog-centos8
Next, restart the Rsyslog server:
$sudo systemctl restart rsyslog
To run Rsyslog at startup, run the following command:
$sudo systemctl enable rsyslog
To confirm that the Rsyslog server is listening on port 514, use the netstat command, as follows:
$sudo netstat-pnltu
Sample output:
Netstat-rsyslog-port-centos8
We have successfully configured the Rsyslog server to receive logs from the client system.
To view log messages in real time, run the following command:
$tail-f / var/log/messages
Now start configuring the client system.
Configure the client system on RHEL 8
Like the Rsyslog server, log in and check if the rsyslog daemon is running with the following command:
$sudo systemctl status rsyslog
Sample output:
Client-rsyslog-service-rhel8
Next, open the rsyslog configuration file:
$sudo vim / etc/rsyslog.conf
At the end of the file, add the following line:
*. * @ 10.128.0.47 Use 514 # Use @ for UDP protocol*.* @ @ 10.128.0.47 Use @ @ for TCP protocol
Save and exit the configuration file. Just like the Rsyslog server, open port 514, which is the default Rsyslog port on the firewall:
$sudo firewall-cmd-add-port=514/tcp-zone=public-permanent
Next, reload the firewall to save the changes:
$sudo firewall-cmd-reload
Next, restart the rsyslog service:
$sudo systemctl restart rsyslog
To run Rsyslog at startup, run the following command:
$sudo systemctl enable rsyslog test logging operation
Once you have successfully installed and configured the Rsyslog server and client, it is time to verify that your configuration is working as expected.
On the client system, run the following command:
# logger "Hello guys! This is our first log"
Now go to the Rsyslog server and run the following command to view the log messages in real time:
# tail-f / var/log/messages
The output of the command run on the client system is displayed in the log of the Rsyslog server, which means that the Rsyslog server is receiving logs from the client system:
The above is how to configure the Rsyslog server in CentOS8. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.