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&#39;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&#39;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(&quot;/dev/log&quot;);</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(=
&quot;/proc/kmsg&quot; program_override(&quot;kernel&quot;));</div><div>};<=
/div><div><br></div><div># source s_syslog { syslog(ip(127.0.0.1) port(1999=
) transport(&quot;tcp&quot;)); };</div>
<div><br></div><div>########################</div><div># Filters</div><div>=
########################</div><div># Here&#39;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 &quot;eneraptor&quot;</div><div>filter f_mail_enerapto=
r { facility(mail) and match(&quot;eneraptor&quot;); };</div><div><br></div=
>
<div>######</div><div># destinations</div><div>destination d_messages =A0 =
=A0 =A0 =A0{ file(&quot;/var/log/messages&quot;); };</div><div>destination =
filtered_messages { file(&quot;/var/log/messages_filtered&quot;); };</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(&quot;localhost&quot;) username(&quot;eneraptor&quot;) password(&qu=
ot;eneraptor&quot;)</div>
<div>=A0=A0database(&quot;eneraptordb&quot;)</div><div>=A0=A0table(&quot;lo=
gs&quot;)</div><div>=A0=A0columns(&quot;datetime varchar(16)&quot;, &quot;h=
ost varchar(32)&quot;, &quot;program varchar(8)&quot;, &quot;pid varchar(8)=
&quot;, &quot;message varchar(200)&quot;)</div>
<div>=A0=A0values(&quot;$R_DATE&quot;, &quot;$HOST&quot;, &quot;$PROGRAM&qu=
ot;, &quot;$PID&quot;, &quot;$MSG&quot;)</div><div>=A0=A0indexes(&quot;date=
time&quot;, &quot;host&quot;, &quot;program&quot;, &quot;pid&quot;, &quot;m=
essage&quot;));</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># &quot;local&quot; 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 &#39;localhost&#39;<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&#39;pgsql&#39;, host=3D&#39;localhost&#39;, port=3D&#39;&#39;, userna=
me=3D&#39;eneraptor&#39;, database=3D&#39;eneraptordb&#39;, error=3D&#39;co=
uld not connect to server: Connection refused\x0a\x09Is the server running =
on host &quot;localhost&quot; and accepting\x0a\x09TCP/IP connections on po=
rt 0?\x0a&#39;</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, &quot;eneraptor test: %d&quot;, counter);</i>=
</div></div><div><br></div><div>From what I could gather is that syslog-ng =
probably can&#39;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