{"id":94,"date":"2017-10-24T09:54:00","date_gmt":"2017-10-24T09:54:00","guid":{"rendered":"https:\/\/linuxadmin.melberi.com\/uncategorized\/rsyslog-remote-login-configuration"},"modified":"2017-10-24T11:43:14","modified_gmt":"2017-10-24T11:43:14","slug":"rsyslog-remote-login-configuration","status":"publish","type":"post","link":"https:\/\/www.melberi.com\/linuxadmin\/rsyslog\/rsyslog-remote-login-configuration","title":{"rendered":"rsyslog Remote Login Configuration Guide with Example iptables"},"content":{"rendered":"<h2><b><u>rsyslog Remote Login Configuration<\/u><\/b>:<\/h2>\n<p><b><u>1. On the Client System:<\/u><\/b><\/p>\n<div style=\"background-color: #eeeeee;\"><b># yum install rsyslog<\/b><\/div>\n<p>Add the following lint (server ip, port) in the existing config file.<br \/>\n#vim \/etc\/rsyslog.conf<\/p>\n<div style=\"background-color: #eeeeee;\">*.* @masterserverip:514\u00a0\u00a0\u00a0\u00a0 (Enables UDP forwarding)<br \/>\n*.* @@masterserverip:514\u00a0\u00a0\u00a0\u00a0 (Enables TCP forwarding, You can use any one protocol )<\/div>\n<p>&nbsp;<\/p>\n<div style=\"background-color: #eeeeee;\"><b>#service rsyslog restart<\/b><\/div>\n<p><u><b>Example Client Server rsyslog.conf file:<\/b><\/u><\/p>\n<div style=\"background-color: #cccccc;\">$ModLoad imuxsock.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imklog.so<\/div>\n<div style=\"background-color: #cccccc;\">$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">*.* @masterserverip:514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">*.info;mail.none;authpriv.none;cron.none \/var\/log\/messages<\/div>\n<div style=\"background-color: #cccccc;\">authpriv.* \/var\/log\/secure<\/div>\n<div style=\"background-color: #cccccc;\">mail.* -\/var\/log\/maillog<\/div>\n<div style=\"background-color: #cccccc;\">cron.* \/var\/log\/cron<\/div>\n<div style=\"background-color: #cccccc;\">*.emerg *<\/div>\n<div style=\"background-color: #cccccc;\">uucp,news.crit \/var\/log\/spooler<\/div>\n<div style=\"background-color: #cccccc;\">local7.* \/var\/log\/boot.log<\/div>\n<p><u><b>2. Rsyslog Master Log Server Configuration:<\/b><\/u><\/p>\n<div style=\"background-color: #eeeeee;\"><b># yum install rsyslog\u00a0 rsyslog-mysql<\/b><\/div>\n<p>#vim \/etc\/rsyslog.conf<\/p>\n<p><u><b>Example Log Server Config File:<\/b><\/u><\/p>\n<div style=\"background-color: #cccccc;\"># Add your Client server IP or IP Range<\/div>\n<div style=\"background-color: #cccccc;\">$AllowedSender UDP, 127.0.0.1, 10.5.0.0\/16, 192.168.1.0\/24<\/div>\n<div style=\"background-color: #cccccc;\">$AllowedSender TCP, 127.0.0.1, 10.5.0.0\/16, 192.168.1.0\/24<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imuxsock.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imklog.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad immark.so<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Provides UDP syslog reception<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imudp.so<\/div>\n<div style=\"background-color: #cccccc;\">$UDPServerRun 514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Provides TCP syslog reception<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imtcp.so<\/div>\n<div style=\"background-color: #cccccc;\">$InputTCPServerRun 514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">*.info;mail.none;authpriv.none;cron.none \/var\/log\/messages<\/div>\n<div style=\"background-color: #cccccc;\">authpriv.* \/var\/log\/secure<\/div>\n<div style=\"background-color: #cccccc;\">mail.* -\/var\/log\/maillog<\/div>\n<div style=\"background-color: #cccccc;\">cron.* \/var\/log\/cron<\/div>\n<div style=\"background-color: #cccccc;\">*.emerg *<\/div>\n<div style=\"background-color: #cccccc;\">uucp,news.crit \/var\/log\/spooler<\/div>\n<div style=\"background-color: #cccccc;\">local7.* \/var\/log\/boot.log<\/div>\n<p>Save the file and restart the service<\/p>\n<div style=\"background-color: #eeeeee;\"><b>#service rsyslog restart<\/b><\/div>\n<p><u><b>3. If you want to use different <\/b><\/u><u><b>template <\/b><\/u><u><b>and log the<\/b><\/u><u><b> <\/b><\/u><u><b>different server logs in to different directory<\/b>.<\/u><br \/>\nyou can add the following in the rsyslog.conf file<\/p>\n<p><u><b>Example File 1(Dynamic Logfile):<\/b><\/u><\/p>\n<div style=\"background-color: #cccccc;\"># Add your Client server IP or IP Range<\/div>\n<div style=\"background-color: #cccccc;\">$AllowedSender UDP, 127.0.0.1, 10.5.0.0\/16, 192.168.1.0\/24<\/div>\n<div style=\"background-color: #cccccc;\">$AllowedSender TCP, 127.0.0.1, 10.5.0.0\/16, 192.168.1.0\/24<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imuxsock.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imklog.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad immark.so<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Provides UDP syslog reception<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imudp.so<\/div>\n<div style=\"background-color: #cccccc;\">$UDPServerRun 514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Provides TCP syslog reception<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imtcp.so<\/div>\n<div style=\"background-color: #cccccc;\">$InputTCPServerRun 514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat<\/div>\n<p><b>$template DynFile,&#8221;\/var\/log\/%HOSTNAME%\/%programname%.log&#8221;<br style=\"background-color: #cccccc; color: black;\" \/>*.* ?DynFile<\/b><\/p>\n<p><u><b>Example File 2 (Manual User Defined Log Files):<\/b><\/u><\/p>\n<div style=\"background-color: #cccccc;\"># Add your Client server IP or IP Range<\/div>\n<div style=\"background-color: #cccccc;\">$AllowedSender UDP, 127.0.0.1, 10.5.0.0\/16, 192.168.1.0\/24<\/div>\n<div style=\"background-color: #cccccc;\">$AllowedSender TCP, 127.0.0.1, 10.5.0.0\/16, 192.168.1.0\/24<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imuxsock.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imklog.so<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad immark.so<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Provides UDP syslog reception<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imudp.so<\/div>\n<div style=\"background-color: #cccccc;\">$UDPServerRun 514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Provides TCP syslog reception<\/div>\n<div style=\"background-color: #cccccc;\">$ModLoad imtcp.so<\/div>\n<div style=\"background-color: #cccccc;\">$InputTCPServerRun 514<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">$template Auth, &#8220;\/var\/log\/%HOSTNAME%\/secure.log&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Log anything (except mail and cron) of level info or higher.<\/div>\n<div style=\"background-color: #cccccc;\">$template MSG, &#8220;\/var\/log\/%HOSTNAME%\/messages&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Log all the mail messages in one place.<\/div>\n<div style=\"background-color: #cccccc;\">$template mail, &#8220;\/var\/log\/%HOSTNAME%\/maillog&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Log cron stuff<\/div>\n<div style=\"background-color: #cccccc;\">$template cron, &#8220;\/var\/log\/%HOSTNAME%\/cron&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Save news errors of level crit and higher in a special file.<\/div>\n<div style=\"background-color: #cccccc;\">$template spool, &#8220;\/var\/log\/%HOSTNAME%\/spooler&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Save boot messages also to boot.log<\/div>\n<div style=\"background-color: #cccccc;\">$template boot, &#8220;\/var\/log\/%HOSTNAME%\/boot.log&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Save kern messages also to console<\/div>\n<div style=\"background-color: #cccccc;\">$template kern, &#8220;\/var\/log\/%HOSTNAME%\/kernal&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\"># Everybody gets emergency messages<\/div>\n<div style=\"background-color: #cccccc;\">$template emerg, &#8220;\/var\/log\/%HOSTNAME%\/emerg&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">#Save doemon message in daemon.log<\/div>\n<div style=\"background-color: #cccccc;\">$template daemon, &#8220;\/var\/log\/%HOSTNAME%\/daemon.log&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">#Save news message in news.log<\/div>\n<div style=\"background-color: #cccccc;\">$template news, &#8220;\/var\/log\/%HOSTNAME%\/news.log&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">#Save User log messages<\/div>\n<div style=\"background-color: #cccccc;\">$template user, &#8220;\/var\/log\/%HOSTNAME%\/user.log&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">#Save Wrapper messages<\/div>\n<div style=\"background-color: #cccccc;\">$template local, &#8220;\/var\/log\/%HOSTNAME%\/tcpwrapper.log&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">#Save dmesg message<\/div>\n<div style=\"background-color: #cccccc;\">$template all, &#8220;\/var\/log\/%HOSTNAME%\/all&#8221;<\/div>\n<div style=\"background-color: #cccccc;\"><\/div>\n<div style=\"background-color: #cccccc;\">authpriv.* ?Auth<\/div>\n<div style=\"background-color: #cccccc;\">*.info,mail.none,authpriv.none,cron.none ?MSG<\/div>\n<div style=\"background-color: #cccccc;\">mail.* ?mail<\/div>\n<div style=\"background-color: #cccccc;\">cron.* ?cron<\/div>\n<div style=\"background-color: #cccccc;\">news.crit ?spool<\/div>\n<div style=\"background-color: #cccccc;\">local7.* ?boot<\/div>\n<div style=\"background-color: #cccccc;\">kern.* ?kern<\/div>\n<div style=\"background-color: #cccccc;\">*.emerg ?emerg<\/div>\n<div style=\"background-color: #cccccc;\">user.* ?user<\/div>\n<div style=\"background-color: #cccccc;\">daemon.*,daemon,daemon.notice,daemon.err ?daemon<\/div>\n<div style=\"background-color: #cccccc;\">news.* ?news<\/div>\n<div style=\"background-color: #cccccc;\">*.* ?all<\/div>\n<p><u><b>4. If you want to save the log file in to cacti syslog mysql database<\/b><\/u><\/p>\n<p>Add the following lined at the end of rsyslog.conf<\/p>\n<div style=\"background-color: #cccccc;\">$ModLoad ommysql<\/div>\n<div style=\"background-color: #cccccc;\">$template cacti_syslog,&#8221;INSERT INTO syslog_incoming(facility, priority, date, time, host, message) values (%syslogfacility%, %syslogpriority%, &#8216;%timereported:::date-mysql%&#8217;, &#8216;%timereported:::date-mysql%&#8217;, &#8216;%HOSTNAME%&#8217;, &#8216;%msg%&#8217;)&#8221;, SQL<\/div>\n<div style=\"background-color: #cccccc;\">*.* \u00a0\u00a0\u00a0 &gt;dbserverip,db_name,db_username,db_password;cacti_syslog<\/div>\n<p><u><b>5. IP Tables Config:<\/b><\/u><br \/>\nadd the following port in the \/etc\/sysconfig\/iptables file ( This is only required in the syslog server)<\/p>\n<div style=\"background-color: #cccccc;\">-A INPUT -p udp -m udp &#8211;dport 514 -j ACCEPT<\/div>\n<p>Or for TCP<\/p>\n<div style=\"background-color: #cccccc;\">-A INPUT -p tcp -m tcp &#8211;dport 514 -j ACCEPT<\/div>\n","protected":false},"excerpt":{"rendered":"<p>rsyslog Remote Login Configuration: 1. On the Client System: # yum install rsyslog Add the following lint (server ip, port) in the existing config file. #vim \/etc\/rsyslog.conf *.* @masterserverip:514\u00a0\u00a0\u00a0\u00a0 (Enables&#8230; <a href=\"https:\/\/www.melberi.com\/linuxadmin\/rsyslog\/rsyslog-remote-login-configuration\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[132],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/94"}],"collection":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":4,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/94\/revisions\/767"}],"wp:attachment":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}