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