<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi, <br>
<br>
I configure my Java application to log with log4j in syslog server,
and i configure my syslog-ng to store data in mysql database, but
this doen't work.<br>
<br>
My syslog-ng configuration is:<br>
<br>
<small>@version: 3.0<br>
options { <br>
chain_hostnames(no); <br>
stats_freq(43200); <br>
};<br>
source src {<br>
unix-stream("/dev/log" max-connections(256));<br>
internal();<br>
udp(ip("127.0.0.1") port(514));<br>
file("/proc/kmsg");<br>
};<br>
destination mcs {
file("/var/log/mw-collaboration/mw-collaboration-loginfile.log");
};<br>
destination mcs_sql {<br>
sql(<br>
type(mysql) <br>
host("localhost") <br>
username("syslogng") <br>
password("syslogng")<br>
database("mcslogin")<br>
table("mcslogin")<br>
columns("date varchar(32)","loginuser varchar(32)
","ipsource varchar(32)")<br>
values("${S_YEAR}-${S_MONTH}-${S_DAY}
${S_HOUR}:${S_MIN}:${S_SEC}","${LOGIN_USER}","${IP_SOURCE}")<br>
);<br>
};<br>
<br>
filter f_mcs { facility(local2); };<br>
parser p_mcs {<br>
db_parser(file("/etc/syslog-ng/patterndb.d/mcs.xml"));<br>
};<br>
log { source(src); filter(f_mcs); parser(p_mcs);
destination(mcs_sql); destination(mcs); };</small><br>
<br>
I created also a db_parser file that is:<br>
<small><br>
<patterndb version='1' pub_date='2010-12-14'><br>
<program name='mcs'><br>
<pattern>mcs</pattern><br>
<rule id='mcs' class='system'><br>
<pattern>###############Accesso dell'utente
@STRING:LOGIN_USER@ da ip @IPv4:IP_SOURCE@</pattern><br>
</rule><br>
</program><br>
</patterndb></small><br>
<br>
With this configuration, i have that in <small><big>"mcs"</big> <big>destination
it writes all information:<br>
<br>
Dec 16 11:55:44 localhost mcs[123] ###############Accesso
dell'utente <a class="moz-txt-link-abbreviated" href="mailto:xxxx@xxx.mailware.it">xxxx@xxx.mailware.it</a> da ip 111.222.333.444<br>
Dec 16 12:53:23 localhost mcs[123] ###############Accesso
dell'utente <a class="moz-txt-link-abbreviated" href="mailto:xxxx.1@xxx.mailware.it">xxxx.1@xxx.mailware.it</a> da ip </big></small><small><big>111.222.333.444</big></small><br>
<small><big>Dec 16 14:07:40 localhost mcs[123]
###############Accesso dell'utente <a class="moz-txt-link-abbreviated" href="mailto:xxxx.1@xxx.mailware.it">xxxx.1@xxx.mailware.it</a> da ip
</big></small><small><big>111.222.333.444</big></small><br>
<br>
but in "mcs_sql" destination, it writes only date:<br>
<small><br>
mysql> desc mcslogin;<br>
+-----------+-------------+------+-----+---------+-------+<br>
| Field | Type | Null | Key | Default | Extra |<br>
+-----------+-------------+------+-----+---------+-------+<br>
| date | varchar(32) | YES | MUL | NULL | |<br>
| loginuser | varchar(32) | YES | | NULL | |<br>
| ipsource | varchar(32) | YES | | NULL | |<br>
+-----------+-------------+------+-----+---------+-------+<br>
3 rows in set (0.00 sec)<br>
<br>
mysql> select * from mcslogin limit 10<br>
-> ;<br>
+---------------------+-----------+----------+<br>
| date | loginuser | ipsource |<br>
+---------------------+-----------+----------+<br>
| 2010-12-15 11:02:16 | | |<br>
| 2010-12-15 11:11:09 | | |<br>
| 2010-12-15 17:53:01 | | |<br>
| 2010-12-15 18:11:55 | | |<br>
| 2010-12-15 18:12:54 | | |<br>
| 2010-12-15 18:35:07 | | |<br>
| 2010-12-16 11:55:36 | | |<br>
| 2010-12-16 11:55:44 | | |<br>
| 2010-12-16 11:55:44 | | |<br>
| 2010-12-16 12:53:23 | | |<br>
+---------------------+-----------+----------+<br>
10 rows in set (0.00 sec)</small><br>
<br>
Can you help me?<br>
<br>
Thanks<br>
<small><big><br>
</big></small>
</body>
</html>