Installation sous Debian :
apt-get install syslog-ng
Editer le fichier de configuration syslog-ng
vim /etc/syslog-ng/syslog-ng.conf
Dans la partie « source » ajouter :
# # If you wish to get logs from remote machine you will need this server # to listen upon port 514. # source remote { tcp(port(514) keep-alive(no)); };
Dans la partie « destination » ajouter :
# # Automatic host sorting # Store all files beneath '/var/log/NAME OF MACHINE/facility # Create these directories if required, with the given permissions. # destination hosts { file("/var/log/HOSTS/$HOST/$FACILITY" owner(root) group(root) perm(0600) dir_perm(0700) create_dirs(yes)); };
Dans la partie « log » ajouter :
# # log by host (as defined above) anything that's coming from the # remote socket. # log { source(remote); destination(hosts); };
Recharger syslog-ng :
/etc/init.d/syslog-ng restart
Editer le fichier de configuration syslog
vim /etc/syslog-ng/syslog-ng.conf
Puis insérer par exemple le contenu suivant pour tout envoyer vers le serveur syslog-bg (192.168.1.1) :
# Log remotely # ############################################################### ## The IP address of the loghost. destination loghost {tcp("192.168.1.1" port(514));}; # send everything to loghost now that we've defined it. log { source(s_all); destination(loghost); }; ###############################################################
Recharger syslog-ng :
/etc/init.d/syslog-ng restart