Install and configure rsyslog Centralized logging server in CentOS 6
Configure rsyslog in RHEL 6.x / CentOS 6.x
Step 1 : Enable the module.We will uncomment the below given line by removing
#Edit the file /etc/rsyslog.conf
Uncomment by removing # in front of these module names
module(load="imuxsock") # provides support for local system logging (e.g. via logger command)module(load="imklog") # provides kernel logging support (previously done by rklogd
Now, in same file , search for line *.emerg *. Modify the action (i.e *) with :omusrmsg:* . See below given reference
*.emerg :omusrmsg:*
Now, at the end of file /etc/rsyslog.conf, paste the below given code(These are rsyslog templates)
#
$template TmplAuth, "/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
$template TmplMsg, "/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
authpriv.* ?TmplAuth
*.info,mail.none,authpriv.none,cron.none ?TmplMsg
Now , save and exit from file vi /etc/rsyslog.conf
Or just copy or paste the rsyslog file from below:
[root@ELK-SYSLOG ~]# egrep -v '^#|^$' /etc/rsyslog.conf -v
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
$ModLoad imudp
$UDPServerRun 514
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
*.info;mail.none;authpriv.none;cron.none /var/log/messages
authpriv.* /var/log/secure
mail.* -/var/log/maillog
cron.* /var/log/cron
*.emerg :omusrmsg:*
uucp,news.crit /var/log/spooler
local7.* /var/log/boot.log
kern.* /var/log/iptables.log
kern.crit /var/log/iptables-crit.log
kern.info /var/log/iptables-info.log
$template TmplAuth, "/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
$template TmplMsg, "/var/log/%HOSTNAME%/%PROGRAMNAME%.log"
authpriv.* ?TmplAuth
*.info,mail.none,authpriv.none,cron.none ?TmplMsg
Start/Restart the rsyslog service
/etc/init.d/rsyslog restart
then look on /var/log/message, should be following:
Dec 3 19:10:24 ELK-SYSLOG rsyslogd: [origin software="rsyslogd" swVersion="7.6.7" x-pid="15234" x-info="http://www.rsyslog.com"] exiting on signal 15.
Dec 3 19:10:24 ELK-SYSLOG rsyslogd: [origin software="rsyslogd" swVersion="7.6.7" x-pid="15307" x-info="http://www.rsyslog.com"] start
Comments
Post a Comment
Thank you for visiting my blog.