Enabling Rsyslog
Rsyslog is the rocket-fast system for log processing, and you can use it to forward logs from the database server onto your own machines.
Rsyslog allows communication between an Rsyslog server and client:
- An Rsyslog server is the machine that receives messages
- An Rsyslog client is the machine that sends messages
You can enable the Rsyslog service on your database server to allow it to become an Rsyslog client.
Setting Up the Rsyslog Server
First, you will need to configure an Rsyslog server to receive messages.
To set up the server, on your machine you’ll need to set up your configuration to accept UDP (or TCP) connections and tell the service what to do with the incoming messages. This can be done like so, in /etc/rsyslog.conf
:
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514" ruleset="remote")
$template Incoming-logs,"/var/log/remote-logs/%HOSTNAME%/%PROGRAMNAME%.log"
ruleset(name="remote"){
action(type="omfile" dynafile="Incoming-logs")
}
This will tell the machine to save all incoming messages sent to port 514 to /var/log/remote-logs/host-name/<program>
.
Make sure to run systemctl restart rsyslog
to ensure that the configuration is being implemented. You will also need to ensure that the desired port is open and listening to TCP or UDP.
Enabling Rsyslog Client on ScaleGrid Database Server
Enabling this service can be done in a few easy steps. Please note that we currently only support Rsyslog services on servers running CentOS7. First, you will need to set the global Rsyslog server configuration:
- In the Settings page, navigate to
Logs
in the sidebar
- From here, click
Configure Rsyslog Settings
to add your Rsyslog servers. You will need the IP address or DNS name and port for the server. You can use either UDP or TCP protocols.
- You can click the Facilities menu to select the logs you wish to be forwarded to your server:
The selected logs will be forwarded to all the servers you added in the previous step.
- Once these settings are saved, they need to be applied at the cluster level. Navigate to your desired cluster’s Admin > Ryslog Config page where you can enable the rsyslog service:
- Saving this will enable the global Rsyslog configurations on the specified database server, and you should begin receiving logs within a few minutes.
If you make any changes to the global Rsyslog configurations, you will need to re-enable Rsyslog on your database.
And that's it! Rsyslog should now be enabled on your specified database server. For further information, please read the official Rsyslog documentation linked below.
Updated about 1 year ago