kriks Posted January 28, 2012 Posted January 28, 2012 (edited) Всем привет. Есть система FreeBSD monitoring-serv-3 9.0-RELEASE syslog-ng starting up; version='3.3.3' Задался вопросом как сбрасывать все syslog-и в мускул для кактусного плагина syslog Погуглив нашел несколько вариантов конфига syslog-ng, но они для версии 3.0 и для моей версии не подходит. Если кто использует такую связку, поделитесь конфигом для сброса логов в мускул. Спасибо. Конфиг sysloga-ng дефолтный. В данный момент все сыпится со свитчей в /var/log/messages Edited January 28, 2012 by kriks Вставить ник Quote
s.lobanov Posted January 28, 2012 Posted January 28, 2012 Для версии 3.2 для postgresql. Думаю, что для mysql аналогично. @version: 3.2 @include "scl.conf" options { use_dns(yes); flush_lines(20); flush_timeout(2000); create_dirs(yes); # sync(1); # flags(store-legacy-msghdr); }; # Remote logging source src_remote { udp(ip("0.0.0.0") port(514) encoding("iso-8859-1") flags(store-legacy-msghdr)); tcp(ip("0.0.0.0") port(514) encoding("iso-8859-1") flags(store-legacy-msghdr)); # flags(store-legacy-msghdr); }; destination d_pgsql { sql(type(pgsql) host("192.168.666.666") username("syslog") password("password") port(5432) database("db") table("rlogs") columns("host cidr", "pri smallint", "msg text") values("$SOURCEIP", "$PRI", "$MSGHDR$MESSAGE") indexes("host", "truetime", "pri") ); }; log { source(src_remote); destination(d_pgsql); }; Вставить ник Quote
kriks Posted January 28, 2012 Author Posted January 28, 2012 Starting syslog_ng. WARNING: Configuration file has no version number, assuming syslog-ng 2.1 format. Please add @version: maj.min to the beginning of the file; WARNING: Configuration file format is too old, please update it to use the 3.3 format as some constructs might operate inefficiently; WARNING: global: the default value of chain_hostnames is changing to 'no' in version 3.0, please update your configuration accordingly; WARNING: global: the default value of log_fifo_size() has changed to 10000 in version 3.3 to reflect log_iw_size() changes for tcp()/udp() window size changes; WARNING: input: sources do not remove new-line characters from messages by default in version 3.0, please add 'no-multi-line' flag to your configuration if you want to retain this functionality; WARNING: Your configuration uses a newly introduced reserved word as identifier, please use a different name or enclose it in quotes; keyword='encoding', config-version='2.1', version='3.0', filename='/usr/local/etc/syslog-ng.conf', line='15:38' Error parsing afsocket, syntax error, unexpected LL_IDENTIFIER in /usr/local/etc/syslog-ng.conf at line 15, column 38: udp(ip("0.0.0.0") port(514) encoding("iso-8859-1") flags(store-legacy-msghdr)); ^^^^^^^^ syslog-ng documentation: http://www.balabit.com/support/documentation/?product=syslog-ng mailing list: https://lists.balabit.hu/mailman/listinfo/syslog-ng ./syslog-ng: WARNING: failed to start syslog_ng :( Вставить ник Quote
kriks Posted January 28, 2012 Author Posted January 28, 2012 С скидыванием логов в файлы разобрался, а вот с мускулом не как. Вставить ник Quote
johnrz Posted January 31, 2012 Posted January 31, 2012 (edited) С скидыванием логов в файлы разобрался, а вот с мускулом не как. Вот настройки мускула, правда настроен на плагин CAMM source netsrc { udp(ip("0.0.0.0") port(514)); tcp(ip("0.0.0.0") port(514)); }; # CISCO Destinations... destination netlog { file("/var/log/network/$HOST/$YEAR$MONTH$DAY.log" owner(root) group(wheel) perm(0644) create_dirs(yes)); }; destination netsql { program("/usr/local/bin/mysql --user=cacti --password=cacti cacti < /var/log/mysql.pipe"); pipe ("/var/log/mysql.pipe" template("INSERT INTO plugin_camm_syslog (host, sourceip, facility, priority, sys_date, message, status) VALUES ( '$HOST', '$SOURCEIP', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$MSG', '0' );\n") template_escape(yes)); }; log { source(netsrc); destination(netlog); }; log { source(netsrc); destination(netsql); }; а ну и самое важное не забыть перед пергрузкой syslog создать файл mkfifo /var/log/mysql.pipe Edited January 31, 2012 by johnrz Вставить ник Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.