No subject
Sun Oct 3 12:43:47 CEST 2010
database, but I am running out of options on how to resolve this issue. I
would be very grateful if you could help me resolve this issue.
Best regards,
Janez Barbic
--0015175cb24af58cfe04992001e1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,<div>I am a student of Computer Science at University of Ljubljana. Rece=
ntly I started working on some project which includes logging into PostgreS=
QL database.</div><div>I came across some problem which I can't resolve=
myself. No matter what I do, syslog-ng refuses to log into local PostgreSQ=
L database. Here is my current configuration:</div>
<div><br></div><div>using syslog-ng 3.2 server</div><div><br></div><div>con=
tents of syslog-ng.conf</div><div>-----------------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
-</div>
<div><div>@version: 3.2</div><div>#Default configuration file for syslog-ng=
.</div><div>#</div><div># For a description of syslog-ng configuration file=
directives, please read</div><div># the syslog-ng Administrator's guid=
e at:</div>
<div>#</div><div># <a href=3D"http://www.balabit.com/dl/html/syslog-ng-admi=
n-guide_en.html/bk01-toc.html">http://www.balabit.com/dl/html/syslog-ng-adm=
in-guide_en.html/bk01-toc.html</a></div><div>#</div><div><br></div><div>opt=
ions {</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>time=
_reap(30);</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pr=
e"> </span>mark_freq(10);</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>keep_hostname(yes);</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>};</d=
iv><div><br></div><div>######</div><div># sources</div><div>source s_local =
{</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </spa=
n># message generated by Syslog-NG</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>inter=
nal();</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</span># standard Linux log source (this is the default place for the syslo=
g()</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span># fun=
ction to send logs to)</div><div><span class=3D"Apple-tab-span" style=3D"wh=
ite-space:pre"> </span>unix-stream("/dev/log");</div><div><span c=
lass=3D"Apple-tab-span" style=3D"white-space:pre"> </span># messages from t=
he kernel</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>file(=
"/proc/kmsg" program_override("kernel"));</div><div>};<=
/div><div><br></div><div># source s_syslog { syslog(ip(127.0.0.1) port(1999=
) transport("tcp")); };</div>
<div><br></div><div>########################</div><div># Filters</div><div>=
########################</div><div># Here's come the filter options. Wi=
th this rules, we can set which=A0</div><div># message go where.</div><div>
<br></div><div># messages for eneraptor should have priority level LOG_MAIL=
and contain keyword "eneraptor"</div><div>filter f_mail_enerapto=
r { facility(mail) and match("eneraptor"); };</div><div><br></div=
>
<div>######</div><div># destinations</div><div>destination d_messages =A0 =
=A0 =A0 =A0{ file("/var/log/messages"); };</div><div>destination =
filtered_messages { file("/var/log/messages_filtered"); };</div><=
div><br>
</div><div>#</div><div># SQL logging support</div><div>#</div><div><br></di=
v><div>destination d_pgsql {</div><div>=A0=A0sql(type(pgsql)</div><div>=A0=
=A0host("localhost") username("eneraptor") password(&qu=
ot;eneraptor")</div>
<div>=A0=A0database("eneraptordb")</div><div>=A0=A0table("lo=
gs")</div><div>=A0=A0columns("datetime varchar(16)", "h=
ost varchar(32)", "program varchar(8)", "pid varchar(8)=
", "message varchar(200)")</div>
<div>=A0=A0values("$R_DATE", "$HOST", "$PROGRAM&qu=
ot;, "$PID", "$MSG")</div><div>=A0=A0indexes("date=
time", "host", "program", "pid", "m=
essage"));</div>
<div>};</div><div><br></div><div>log {</div><div>source(s_local);</div><div=
>destination(d_messages);</div><div># destination(d_pgsql);</div><div>};</d=
iv><div><br></div><div>log {</div><div>source(s_local);</div><div>filter(f_=
mail_eneraptor);</div>
<div>destination(filtered_messages);</div><div>destination(d_pgsql);</div><=
div>};</div></div><div><meta http-equiv=3D"content-type" content=3D"text/ht=
ml; charset=3Dutf-8">------------------------------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------</div>
<div>using PostgreSQL 8.4</div><div>contents of pg_hba.conf:</div><div><met=
a http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8">------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
------------------------------------</div>
<div><div>...</div><div>#</div><div># Database administrative login by UNIX=
sockets</div><div>local =A0 all =A0 =A0 =A0 =A0 all =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0trust</div><div><br></div><div># TYPE =A0DAT=
ABASE =A0 =A0USER =A0 =A0 =A0 =A0CIDR-ADDRESS =A0 =A0 =A0 =A0 =A0METHOD</di=
v>
<div><br></div><div># "local" is for Unix domain socket connectio=
ns only</div><div># local =A0 all =A0 =A0 =A0 =A0 all =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 trust</div><div># IPv4 local connec=
tions:</div><div># host =A0 =A0all =A0 =A0 =A0 =A0 all =A0 =A0 =A0 =A0 <a h=
ref=3D"http://127.0.0.1/32">127.0.0.1/32</a> =A0 =A0 =A0 =A0 =A0md5</div>
<div># IPv6 local connections:</div><div>host =A0 =A0all =A0 =A0 =A0 =A0 al=
l =A0 =A0 =A0 =A0 ::1/128 =A0 =A0 =A0 =A0 =A0 =A0 =A0 md5</div><div># syslo=
g-ng logger</div><div># host =A0 =A0eneraptordb =A0 =A0 =A0eneraptor =A0 <a=
href=3D"http://127.0.0.1/32">127.0.0.1/32</a> =A0 =A0 =A0 =A0 =A0trust</di=
v>
</div><div><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"><div>------------------------------------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------</div>
<div>As far as I understand this configuration file, any user should have f=
ull access to any database on local machine. At this point, I am not concer=
ned about security issues as I plan to address them after I resolve logging=
problem.</div>
<div><br></div><div>postgresql.conf:</div><div>Below are included only line=
s I uncommented or changed.</div><div><meta http-equiv=3D"content-type" con=
tent=3D"text/html; charset=3Dutf-8"><div>----------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
--------</div>
<div>...</div><div>listen_addresses =3D 'localhost'<span class=3D"A=
pple-tab-span" style=3D"white-space:pre"> </span># what IP address(es) to =
listen on;</div><div>...</div><div>password_encryption =3D on</div><div>...=
</div>
<div><meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-=
8">------------------------------------------------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------</div>
<div>This is the error I get, logged by syslog-ng:</div><div><i>Jan =A05 22=
:00:38 computerName syslog-ng[11080]: Error establishing SQL connection; ty=
pe=3D'pgsql', host=3D'localhost', port=3D'', userna=
me=3D'eneraptor', database=3D'eneraptordb', error=3D'co=
uld not connect to server: Connection refused\x0a\x09Is the server running =
on host "localhost" and accepting\x0a\x09TCP/IP connections on po=
rt 0?\x0a'</i></div>
<div><i><br></i></div><div>Database has also been created, properly named a=
nd has the right user.</div><div><br></div><div>Message I am trying to log =
is being sent by test program written in C, line that sends message is (eve=
ry few seconds):</div>
<div><div><i>syslog(LOG_MAIL, "eneraptor test: %d", counter);</i>=
</div></div><div><br></div><div>From what I could gather is that syslog-ng =
probably can't connect to database, but I am running out of options on =
how to resolve this issue. I would be very grateful if you could help me re=
solve this issue.</div>
<div><br></div><div>Best regards,</div><div>Janez Barbic</div><div></div></=
div><div></div></div><meta http-equiv=3D"content-type" content=3D"text/html=
; charset=3Dutf-8">
--0015175cb24af58cfe04992001e1--
More information about the syslog-ng
mailing list