[syslog-ng]Simple question, MySQL & Log file

Bas Koot syslog-ng@lists.balabit.hu
Thu, 1 May 2003 23:42:33 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_001F_01C3103B.566DB0D0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi everybody!

First of all, i like Syslog-NG ! But i have 1 (simple i think) question =
about it. For my postfix i need to use the /var/log/maillog file (for =
the pop-before-smtp feature) but at this moment everything is putted =
into the MySQL database.

Somebody knows how to get the mail data in the database AND into the log =
file?

My current config:
# sources
source src { unix-stream("/dev/log"); internal(); };
source kernsrc { file("/proc/kmsg"); };

# destinations
destination dmysql      {
        pipe("/tmp/mysql.pipe"
        template("INSERT INTO logs (host,facility,priority,level,tag,
                  timestamp,program,msg) VALUES ('$HOST','$FACILITY',
                  '$PRIORITY','$LEVEL','$TAG','$UNIXTIME','$PROGRAM',
                  '$MSG');\n")
        template-escape(yes));
};

destination maillog { file("/var/log/maillog"); };

# logs
log { source(src); destination(dmysql); };
log { source(kernsrc); destination(dmysql); };


Thanks!

Greetings,
Bas Koot.
------=_NextPart_000_001F_01C3103B.566DB0D0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everybody!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>First of all, i like Syslog-NG ! But i =
have 1=20
(simple i think) question about it. For my postfix i need to use the=20
/var/log/maillog file (for the pop-before-smtp feature) but at this =
moment=20
everything is putted into the MySQL database.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Somebody knows how to get the mail data =
in the=20
database AND into the log file?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My current config:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2># sources<BR>source src { =
unix-stream("/dev/log");=20
internal(); };<BR>source kernsrc { file("/proc/kmsg"); };</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2># destinations<BR>destination=20
dmysql&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
pipe("/tmp/mysql.pipe"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
template("INSERT INTO logs=20
(host,facility,priority,level,tag,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
timestamp,program,msg) VALUES=20
('$HOST','$FACILITY',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
'$PRIORITY','$LEVEL','$TAG','$UNIXTIME','$PROGRAM',<BR>&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
'$MSG');\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
template-escape(yes));<BR>};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>destination maillog { =
file("/var/log/maillog");=20
};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2># logs<BR>log { source(src); =
destination(dmysql);=20
};<BR>log { source(kernsrc); destination(dmysql); };<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Greetings,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Bas Koot.</DIV></FONT></BODY></HTML>

------=_NextPart_000_001F_01C3103B.566DB0D0--