Configure rsyslog, configure syslog
Configuring rsyslog on the Centralized Logging Server
The steps in this procedure must be followed on the system that you
intend to use as your centralized logging sever. All steps in this
procedure must be run while logged in as the
root
user.
- Configure SELinux to allow rsyslog traffic.
# semanage -a -t syslogd_port_t -p udp 514
- Configure the
iptables
firewall to allow rsyslog traffic.- Open the
/etc/sysconfig/iptables
file in a text editor. - Add an
INPUT
rule allowing UDP traffic on port514
to the file. The new rule must appear before anyINPUT
rules thatREJECT
traffic.-A INPUT -m state --state NEW -m udp -p udp --dport 514 -j ACCEPT
- Save the changes to the
/etc/sysconfig/iptables
file. - Restart the
iptables
service for the firewall changes to take effect.#
service iptables restart
- Open the
/etc/rsyslog.conf
file in a text editor.- Add this line to the file, defining the location logs will be saved to:
$template TmplAuth, "/var/log/%HOSTNAME%/%PROGRAMNAME%.log" authpriv.* ?TmplAuth *.info,mail.none,authpriv.none,cron.none ?TmplMsg
- Remove the comment character (#) from the beginning of these lines in the file:
#$ModLoad imudp #$UDPServerRun 514
Save the changes to the/etc/rsyslog.conf
file.Your centralized log server is now configured to receive and store log files from the other systems in your environment.
$template DynFile,"/var/log/syslog/%HOSTNAME%/%$YEAR%.%$MONTH%.%$DAY%/date.log"
:source, !isequal, "localhost" ?DynFile
:source, !isequal, "localhost" ?DynFile ~
Comments
Post a Comment