[syslog-ng]MYSQL problem

_/CaT\_ cat_roger22@hotmail.com
Wed, 25 Sep 2002 17:53:17 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C264BC.6DDEEA70
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Thanks for support.
This is a new point of view:
#!/usr/bin/perl

#-----------------------------------------------------------------------
---------
$|=1;
use DBI;
use strict;
 

$ENV{'DBI_DSN'}='syslog';
$ENV{'DBI_USER'}='root';
$ENV{'DBI_PASS'}='mysqladmin';
$ENV{'DBI_TABLE_SYSLOG'}='logs';
$ENV{'DBI_PIPE_SYSLOG'}='/var/chroot/syslog-ng/tmp/mysql.pipe';
 
my $DB_SB='mysql';
 
my $test_dsn      = $ENV{'DBI_DSN'}   ||  die "DSN not set\n";
my $test_user     = $ENV{'DBI_USER'}  ||  die "User not set\n";
my $test_password = $ENV{'DBI_PASS'}  ||  die "Password not set\n";
my $table         = $ENV{'DBI_TABLE_SYSLOG'} || die "Table not set\n";
my $pipe          = $ENV{'DBI_PIPE_SYSLOG'} || die "Pipe file not
set\n";
 
my $DATA_SOURCE='dbi:mysql:'.$test_dsn;
 
my $dbh;
my $riga;
 
$dbh = DBI->connect($DATA_SOURCE, $test_user, $test_password,
{RaiseError => 1,PrintError => 2}) or die "Can\'t connect:
$DBI::errstr\n";
 
#print STDOUT "Connect to $DATA_SOURCE... done\n";
 
open(FF,"$pipe") || die "Error on read pipe $pipe\n";
 
while($riga=<FF>) {
        #print STDOUT "$riga\n";
 
        $dbh->do($riga) or warn "WARN; Errore nel do\n";
 
        #$dbh->commit;
        #$sth = $dbh->prepare($q));
        #$sth->execute();
 
}
close(FF);
 
$dbh->disconnect() or die "ERROR on close: $DBI::errstr\n";
#print STDOUT "Disconnect to $DATA_SOURCE... done\n";
#-----------------------------------------------------------------------
------------
#End
#-----------------------------------------------------------------------
------------
 

-----Original Message-----
From: syslog-ng-admin@lists.balabit.hu
[mailto:syslog-ng-admin@lists.balabit.hu] On Behalf Of Michael Earls
Sent: Tuesday, September 24, 2002 3:18 PM
To: syslog-ng@lists.balabit.hu
Subject: Re: [syslog-ng]MYSQL problem


What ver of syslog-ng are u running? The dbName, dbPassword, and
dbUsername are stored in the script and that script then takes the input
from the mysql.pipe,  or from the command line
mysql -u root --password=passwd syslog < /tmp/mysql.pipe
 
Look the scripts,, http://www.vermeer.org/syslog/scripts  
 
michael


>>> cat_roger22@hotmail.com 09/24/02 08:13AM >>>
Hi *,
I didn't understood the posts on the mailing list about the entryes
inserted into syslog-db, I've some questions:

destination d_mysql {
  pipe("/var/chroot/syslog-ng/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));
};

I verified  the conf file with "-s" option and it didn't returned any
error.
The Db works fine and I noticed that other people have the same
problem...What is the solution ?
...And... Where is set the DB name  variable ?...in a conf file I
suppose....but where is that ?

I Activated the debug option but the output was :

gc_mark: Marking object of class 'UNKNOWN' (1)

I see the same output even if I don't use mysql option....

Ciao

_______________________________________________
syslog-ng maillist  -  syslog-ng@lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog-ng
Frequently asked questions at http://www.campin.net/syslog-ng/faq.html




------=_NextPart_000_0000_01C264BC.6DDEEA70
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR></HEAD>
<BODY style=3D"MARGIN-TOP: 2px; FONT: 8pt Tahoma; MARGIN-LEFT: 2px">
<DIV><SPAN class=3D906084915-25092002><FONT size=3D1>Thanks for=20
support.</FONT></SPAN></DIV>
<DIV><SPAN class=3D906084915-25092002><FONT size=3D1>This is a new point =
of=20
view:</FONT></SPAN></DIV>
<DIV><SPAN class=3D906084915-25092002><FONT size=3D1>#!/usr/bin/perl<BR>
<DIV><SPAN class=3D906084915-25092002><FONT=20
size=3D1>#---------------------------------------------------------------=
-----------------</FONT></SPAN></DIV></FONT></SPAN></DIV>
<DIV><SPAN class=3D906084915-25092002><FONT size=3D1>$|=3D1;<BR>use =
DBI;<BR>use=20
strict;</FONT></SPAN></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV><SPAN class=3D906084915-25092002>
<DIV><BR><FONT=20
size=3D1>$ENV{'DBI_DSN'}=3D'syslog';<BR>$ENV{'DBI_USER'}=3D'root';<BR>$EN=
V{'DBI_PASS'}=3D'mysqladmin';<BR>$ENV{'DBI_TABLE_SYSLOG'}=3D'logs';<BR>$E=
NV{'DBI_PIPE_SYSLOG'}=3D'/var/chroot/syslog-ng/tmp/mysql.pipe';</FONT></D=
IV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>my $DB_SB=3D'mysql';</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>my $test_dsn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D=20
$ENV{'DBI_DSN'}&nbsp;&nbsp; ||&nbsp; die "DSN not set\n";<BR>my=20
$test_user&nbsp;&nbsp;&nbsp;&nbsp; =3D $ENV{'DBI_USER'}&nbsp; ||&nbsp; =
die "User=20
not set\n";<BR>my $test_password =3D $ENV{'DBI_PASS'}&nbsp; ||&nbsp; die =
"Password=20
not set\n";<BR>my $table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
=3D=20
$ENV{'DBI_TABLE_SYSLOG'} || die "Table not set\n";<BR>my=20
$pipe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D=20
$ENV{'DBI_PIPE_SYSLOG'} || die "Pipe file not set\n";</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>my =
$DATA_SOURCE=3D'dbi:mysql:'.$test_dsn;</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>my $dbh;<BR>my $riga;</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>$dbh =3D DBI-&gt;connect($DATA_SOURCE, $test_user,=20
$test_password, {RaiseError =3D&gt; 1,PrintError =3D&gt; 2}) or die =
"Can\'t connect:=20
$DBI::errstr\n";</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>#print STDOUT "Connect to $DATA_SOURCE...=20
done\n";</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>open(FF,"$pipe") || die "Error on read pipe=20
$pipe\n";</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>while($riga=3D&lt;FF&gt;)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #print STDOUT=20
"$riga\n";</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
$dbh-&gt;do($riga)=20
or warn "WARN; Errore nel do\n";</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
#$dbh-&gt;commit;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #$sth =
=3D=20
$dbh-&gt;prepare($q));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
#$sth-&gt;execute();</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>}<BR>close(FF);</FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT size=3D1>$dbh-&gt;disconnect() or die "ERROR on close:=20
$DBI::errstr\n";<BR>#print STDOUT "Disconnect to $DATA_SOURCE...=20
done\n";<BR><SPAN=20
class=3D906084915-25092002>#---------------------------------------------=
--------------------------------------</SPAN></FONT></DIV>
<DIV><FONT size=3D1><SPAN =
class=3D906084915-25092002>#End</SPAN></FONT></DIV>
<DIV><FONT size=3D1><SPAN=20
class=3D906084915-25092002>#---------------------------------------------=
--------------------------------------</SPAN></FONT></DIV>
<DIV><FONT size=3D1></FONT>&nbsp;</DIV></SPAN>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
  size=3D2>-----Original Message-----<BR><B>From:</B>=20
  syslog-ng-admin@lists.balabit.hu =
[mailto:syslog-ng-admin@lists.balabit.hu]=20
  <B>On Behalf Of </B>Michael Earls<BR><B>Sent:</B> Tuesday, September =
24, 2002=20
  3:18 PM<BR><B>To:</B> syslog-ng@lists.balabit.hu<BR><B>Subject:</B> =
Re:=20
  [syslog-ng]MYSQL problem<BR><BR></FONT></DIV>
  <DIV><FONT size=3D3>What ver of syslog-ng are u running? The dbName, =
dbPassword,=20
  and dbUsername&nbsp;are stored in the script&nbsp;and that script then =
takes=20
  the&nbsp;input from&nbsp;the mysql.pipe,&nbsp; or from the command=20
  line</FONT></DIV>
  <DIV><FONT size=3D3>mysql -u root --password=3Dpasswd syslog &lt;=20
  /tmp/mysql.pipe</FONT></DIV>
  <DIV><FONT size=3D3></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D3>Look the scripts,, <A=20
  =
href=3D"http://www.vermeer.org/syslog/scripts">http://www.vermeer.org/sys=
log/scripts</A>&nbsp;=20
  </FONT></DIV>
  <DIV><FONT size=3D3></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D3>michael</FONT></DIV>
  <DIV><BR><BR>&gt;&gt;&gt; cat_roger22@hotmail.com 09/24/02 08:13AM=20
  &gt;&gt;&gt;<BR>Hi *,<BR>I didn't understood the posts on the mailing =
list=20
  about the entryes<BR>inserted into syslog-db, I've some=20
  questions:<BR><BR>destination d_mysql {<BR>&nbsp;=20
  =
pipe("/var/chroot/syslog-ng/tmp/mysql.pipe"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
  template("INSERT INTO=20
  =
logs<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
  (host, facility, priority, level, tag, date, time,<BR>program,=20
  =
msg)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
  VALUES ( '$HOST', '$FACILITY', '$PRIORITY',=20
  =
'$LEVEL',<BR>'$TAG',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$PROGRAM',<BR>'$MSG'=20
  );\n")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  template_escape(yes));<BR>};<BR><BR>I verified&nbsp; the conf file =
with "-s"=20
  option and it didn't returned any<BR>error.<BR>The Db works fine and I =
noticed=20
  that other people have the same<BR>problem...What is the solution=20
  ?<BR>...And... Where is set the DB name&nbsp; variable ?...in a conf =
file=20
  I<BR>suppose....but where is that ?<BR><BR>I Activated the debug =
option but=20
  the output was :<BR><BR>gc_mark: Marking object of class 'UNKNOWN'=20
  (1)<BR><BR>I see the same output even if I don't use mysql=20
  =
option....<BR><BR>Ciao<BR><BR>___________________________________________=
____<BR>syslog-ng=20
  maillist&nbsp; -&nbsp; syslog-ng@lists.balabit.hu<BR><A=20
  =
href=3D"https://lists.balabit.hu/mailman/listinfo/syslog-ng">https://list=
s.balabit.hu/mailman/listinfo/syslog-ng</A><BR>Frequently=20
  asked questions at <A=20
  =
href=3D"http://www.campin.net/syslog-ng/faq.html">http://www.campin.net/s=
yslog-ng/faq.html</A><BR><BR></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0000_01C264BC.6DDEEA70--