i use syslog-ng 2.0
Hi
in my syslog-ng server i can write log comming from the client to a file
Code:
source mysrc{ tcp(ip(0.0.0.0) port(514) keep-alive(yes));
#udp();
};
destination std {
file("/var/log/syslog-ng1/$HOST/messages" owner("root") group("root") perm(0640) dir_perm(0750) create_dirs(yes));
};
log {source(mysrc); destination(std);};
destination std1 {
udp("192.168.1.66" port(514));
};
#filter my_filter {match("Apache"); };
#log {
# source(mysrc);
# filter(my_filter);
# destination(std);
#};
log {
source(mysrc);
destination(std1);
};
but when i use a pipe
Code:
destination d_mysql {
pipe("/tmp/mysql.pipe"
template("INSERT INTO logs (host, facility, priority, level, tag, date,
time, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL',
'$TAG',
'$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n")
template-escape(yes));
};
log { source(mysrc); destination(d_mysql);
the wired thing is that when i :
1 runed the script that binds the pipe to the database
./mysql.bash&
# !/bin/bash
if [ -e /tmp/mysql.pipe ]; then
while [ -e /tmp/mysql.pipe ]
do
mysql -u root -D syslog< /tmp/mysql.pipe
done
else
mkfifo /tmp/mysql.pipe
fi
2 created a test sql script
request.sql
INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( 'testhost1', 'testfacility1', 'testpriority1', '0','TestTag1', '2009-04-07', '19:00:00', 'Apache', 'Test Message' );
3 injected it into the pipe
cat request.sql > /tmp/mysql.pipe
4 tetsted a select * from tags;
i found the values on request.sql
strange isn't it?
so what can i do