Hi Matthew, I solved it! :) Thank you for pointing out the obvious, I had issues with port. Even though I noticed zeroed out port I paid no attention to it because I assumed syslog-ng used default Postgres port. Postgres is listening to port 5432 (default), but syslog-ng was sending packets to port 0 (again, thanks for Wireshark idea). So I just pointed syslog-ng to the correct port and it started to work. I must also say that I am positively surprised by really fast response :) Best regards, Janez Barbic On Wed, Jan 5, 2011 at 10:31 PM, Matthew Hall <mhall@mhcomputing.net> wrote:
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.
______________________________________________________________________________ Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.campin.net/syslog-ng/faq.html