Syslog-ng
Z Wiki UnArt Slavičín
Instalace:
apt-get install syslog-ng libdbd-mysql
source s_network {
udp(ip("0.0.0.0") port(514));
};
destination d_mysql {
sql(type(mysql) host("localhost") username("syslogwriter") password("syslogwriter-password") database("syslog") table("logs") columns("host", "facility", "priority", "level", "tag", "datetime", "program", "msg") values("$HOST_FROM", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG", "$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC", "$PROGRAM", "$MSG") indexes("host", "facility", "priority", "datetime", "program"));
};
CREATE DATABASE `syslog` DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci;
CREATE USER 'syslogwriter'@'localhost' IDENTIFIED BY 'syslogwriter-password';
GRANT USAGE ON * . * TO 'syslogwriter'@'localhost' IDENTIFIED BY '***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT ALL PRIVILEGES ON `syslog` . * TO 'syslogwriter'@'localhost';