[syslog-ng] logging to PostgreSQL database

Matthew Hall mhall at mhcomputing.net
Wed Jan 5 22:31:39 CET 2011


On Wed, Jan 05, 2011 at 10:24:17PM +0100, Janez Barbič wrote:
> Hi,
> I am a student of Computer Science at University of Ljubljana. Recently I
> started working on some project which includes logging into PostgreSQL
> database.

Welcome to the list.

> This is the error I get, logged by syslog-ng:
> *Jan  5 22:00:38 computerName syslog-ng[11080]: Error establishing SQL
> connection; type='pgsql', host='localhost', port='', username='eneraptor',
> database='eneraptordb', error='could not connect to server: Connection
> refused\x0a\x09Is the server running on host "localhost" and
> accepting\x0a\x09TCP/IP connections on port 0?\x0a'

Are you setting the port right? Here it seems to be zeroed out, which is 
probably bad, there have also been some bugs in syslog-ng and libdbi 
which led to zeroed out or ignored port values before. Try using tcpdump 
or Wireshark or tshark on the lo interface to monitor the connection 
attempt to see if something looks wrong there. You can compare with what 
happens on a successful connect from the CLI client to spot the 
difference.

> Database has also been created, properly named and has the right user.

What happens when you try to query and add values to the table with the 
CLI client?

> 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 resolve this issue.

We can probably help you figure it out but you'll have to do some 
debugging work as well to figure out the specifics.

> Best regards,
> Janez Barbic

Good Luck,
Matthew Hall.


More information about the syslog-ng mailing list