Post by ZF on Jan 17, 2015 0:25:35 GMT -5
yum install wget
Use another pC with browser to verify the below path and release version
wget dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo rpm -Uvh epel-release-7*.rpm
wget dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-13.ius.centos7.noarch.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum install yum-plugin-replace
yum install syslog-ng
syslog-ng -V
chkconfig syslog-ng on
[OPTIONAL]
yum install samba-client
Upload syslog-ng.conf to windows for easy editing
smbclient //<windowsipaddress>/<sharedrivename>
Edit /etc/syslog-ng/syslog-ng.conf, refer to conf below.
Note that
system(); # Check which OS & collect system logs
internal(); # Collect syslog-ng logs
Check IPTables for any entries
iptables -L
iptables -F
Verify syslog-ng.conf with
syslog-ng --syntax-only
OR
syslog-ng -Fevd
-F, –foreground Do not go into the background after initialization
-v, –verbose Be a bit more verbose
-d, –debug Enable debug messages
-t, –trace Enable trace messages
-e, –stderr Log messages to stderr
Once its running successfully, do a service restart.
service syslog-ng restart
To get stats
syslog-ng-ctl stats
Use: www.linuxjournal.com/content/creating-centralized-syslog-server
Sample syslog-ng.conf file
@version:3.5
@include "scl.conf"
# syslog-ng configuration file.
#
# This should behave pretty much like the original syslog on RedHat. But
# it could be configured a lot smarter.
#
# See syslog-ng(8) and syslog-ng.conf(5) for more information.
#
# Note: it also sources additional configuration files (*.conf)
# located in /etc/syslog-ng/conf.d/
# Define Global Options
options {
flush_lines (0);
time_reopen (10);
log_fifo_size (1000);
chain_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (no);
keep_hostname (yes);
};
# Define input source
source s_sys {
system();
internal();
};
source s_net {
udp(ip(0.0.0.0) port(514));
tcp(ip(0.0.0.0) port(514));
};
# Define Destination for Local Logs
destination d_cons { file("/dev/console"); };
destination d_mesg { file("/var/log/messages"); };
destination d_auth { file("/var/log/secure"); };
destination d_mail { file("/var/log/maillog" flush_lines(10)); };
destination d_spol { file("/var/log/spooler"); };
destination d_boot { file("/var/log/boot.log"); };
destination d_cron { file("/var/log/cron"); };
destination d_kern { file("/var/log/kern"); };
destination d_mlal { usertty("*"); };
# Define Destination for Remote Log
destination netlogpile { file(
"/var/syslog-ng/$FULLHOST/$YEAR/$MONTH/$DAY/$FULLHOST-$YEAR-$MONTH-$DAY.log"
owner(root) group(root) perm (0600)
create_dirs ( yes ) dir_perm( 0700 ));
};
filter f_kernel { facility(kern); };
filter f_default { level(info..emerg) and
not (facility(mail)
or facility(authpriv)
or facility(cron)); };
filter f_auth { facility(authpriv); };
filter f_mail { facility(mail); };
filter f_emergency { level(emerg); };
filter f_news { facility(uucp) or
(facility(news)
and level(crit..emerg)); };
filter f_boot { facility(local7); };
filter f_cron { facility(cron); };
# Define local logging destination
#log { source(s_sys); filter(f_kernel); destination(d_cons); };
log { source(s_sys); filter(f_kernel); destination(d_kern); };
log { source(s_sys); filter(f_default); destination(d_mesg); };
log { source(s_sys); filter(f_auth); destination(d_auth); };
log { source(s_sys); filter(f_mail); destination(d_mail); };
log { source(s_sys); filter(f_emergency); destination(d_mlal); };
log { source(s_sys); filter(f_news); destination(d_spol); };
log { source(s_sys); filter(f_boot); destination(d_boot); };
log { source(s_sys); filter(f_cron); destination(d_cron); };
# Define network logging destination
log { source(s_net); destination(netlogpile); };
# Source additional configuration files (.conf extension only)
@include "/etc/syslog-ng/conf.d/*.conf"
# vim:ft=syslog-ng:ai:si:ts=4:sw=4:et:
Use another pC with browser to verify the below path and release version
wget dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo rpm -Uvh epel-release-7*.rpm
wget dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-13.ius.centos7.noarch.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum install yum-plugin-replace
yum install syslog-ng
syslog-ng -V
chkconfig syslog-ng on
[OPTIONAL]
yum install samba-client
Upload syslog-ng.conf to windows for easy editing
smbclient //<windowsipaddress>/<sharedrivename>
Edit /etc/syslog-ng/syslog-ng.conf, refer to conf below.
Note that
system(); # Check which OS & collect system logs
internal(); # Collect syslog-ng logs
Check IPTables for any entries
iptables -L
iptables -F
Verify syslog-ng.conf with
syslog-ng --syntax-only
OR
syslog-ng -Fevd
-F, –foreground Do not go into the background after initialization
-v, –verbose Be a bit more verbose
-d, –debug Enable debug messages
-t, –trace Enable trace messages
-e, –stderr Log messages to stderr
Once its running successfully, do a service restart.
service syslog-ng restart
To get stats
syslog-ng-ctl stats
Use: www.linuxjournal.com/content/creating-centralized-syslog-server
Sample syslog-ng.conf file
@version:3.5
@include "scl.conf"
# syslog-ng configuration file.
#
# This should behave pretty much like the original syslog on RedHat. But
# it could be configured a lot smarter.
#
# See syslog-ng(8) and syslog-ng.conf(5) for more information.
#
# Note: it also sources additional configuration files (*.conf)
# located in /etc/syslog-ng/conf.d/
# Define Global Options
options {
flush_lines (0);
time_reopen (10);
log_fifo_size (1000);
chain_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (no);
keep_hostname (yes);
};
# Define input source
source s_sys {
system();
internal();
};
source s_net {
udp(ip(0.0.0.0) port(514));
tcp(ip(0.0.0.0) port(514));
};
# Define Destination for Local Logs
destination d_cons { file("/dev/console"); };
destination d_mesg { file("/var/log/messages"); };
destination d_auth { file("/var/log/secure"); };
destination d_mail { file("/var/log/maillog" flush_lines(10)); };
destination d_spol { file("/var/log/spooler"); };
destination d_boot { file("/var/log/boot.log"); };
destination d_cron { file("/var/log/cron"); };
destination d_kern { file("/var/log/kern"); };
destination d_mlal { usertty("*"); };
# Define Destination for Remote Log
destination netlogpile { file(
"/var/syslog-ng/$FULLHOST/$YEAR/$MONTH/$DAY/$FULLHOST-$YEAR-$MONTH-$DAY.log"
owner(root) group(root) perm (0600)
create_dirs ( yes ) dir_perm( 0700 ));
};
filter f_kernel { facility(kern); };
filter f_default { level(info..emerg) and
not (facility(mail)
or facility(authpriv)
or facility(cron)); };
filter f_auth { facility(authpriv); };
filter f_mail { facility(mail); };
filter f_emergency { level(emerg); };
filter f_news { facility(uucp) or
(facility(news)
and level(crit..emerg)); };
filter f_boot { facility(local7); };
filter f_cron { facility(cron); };
# Define local logging destination
#log { source(s_sys); filter(f_kernel); destination(d_cons); };
log { source(s_sys); filter(f_kernel); destination(d_kern); };
log { source(s_sys); filter(f_default); destination(d_mesg); };
log { source(s_sys); filter(f_auth); destination(d_auth); };
log { source(s_sys); filter(f_mail); destination(d_mail); };
log { source(s_sys); filter(f_emergency); destination(d_mlal); };
log { source(s_sys); filter(f_news); destination(d_spol); };
log { source(s_sys); filter(f_boot); destination(d_boot); };
log { source(s_sys); filter(f_cron); destination(d_cron); };
# Define network logging destination
log { source(s_net); destination(netlogpile); };
# Source additional configuration files (.conf extension only)
@include "/etc/syslog-ng/conf.d/*.conf"
# vim:ft=syslog-ng:ai:si:ts=4:sw=4:et: