Hello, When I try to use mongodb, I receive the following error message: Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: syslog-ng starting up; version='3.3.0alpha0' Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Network error while inserting into MongoDB; time_reopen='60' The relevant part of my syslog-ng.conf is (taken from an earlier e-mail on the list): destination d_mongodb { mongodb( host("localhost") port(27017) database("syslog-ng") collection("logs") keys("date", "facility", "level", "host", "program", "pid", "message") values("${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:${R_MIN}:${R_SEC}", "$FACILITY", "$LEVEL", "$HOST","$PROGRAM", "$PID", "$MSGONLY") ); }; log { source(s_local); destination(d_mongodb); }; Version (latest git) compiled on openSUSE factory: linux-8k4b:/usr/local/etc # /usr/local/sbin/syslog-ng -V syslog-ng 3.3.0alpha0 Installer-Version: 3.3.0alpha0 Revision: Compile-Date: Feb 2 2011 14:27:08 Enable-Debug: off Enable-GProf: off Enable-Memtrace: off Enable-Sun-STREAMS: off Enable-IPv6: on Enable-Spoof-Source: on Enable-TCP-Wrapper: on Enable-SSL: on Enable-SQL: on Enable-Linux-Caps: off Enable-Pcre: on Enable-Pacct: off linux-8k4b:/usr/local/etc # Using tcpdump I can't even see a connection attempt. Connecton using mongodb tools work fine. linux-8k4b:/usr/local/etc # mongo --version MongoDB shell version: 1.6.6-pre- But as packets don't even reach the mongodb server, it's most likely not a relevant information... Bye, -- Peter Czanik (CzP) <czanik@balabit.hu> BalaBit IT Security / syslog-ng upstream http://czanik.blogs.balabit.com/
When I try to use mongodb, I receive the following error message:
Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: syslog-ng starting up; version='3.3.0alpha0' Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Network error while inserting into MongoDB; time_reopen='60'
The relevant part of my syslog-ng.conf is (taken from an earlier e-mail on the list):
destination d_mongodb { mongodb( host("localhost") port(27017) database("syslog-ng") collection("logs") keys("date", "facility", "level", "host", "program", "pid", "message") values("${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:${R_MIN}:${R_SEC}", "$FACILITY", "$LEVEL", "$HOST","$PROGRAM", "$PID", "$MSGONLY") ); };
That seems correct. Could it be caused by apparmor or some other similar thing? If not, I'd appreciate if you could send me a strace of syslog-ng (privately, the list would probably reject it anyway). Connection can only fail if: * socket() fails, but that is highly unlikely. * connect() fails, but then you'd see something on tcpdump, I believe. * setsockopt() or fcntl fails (unlikely, imo) * malloc fails (again, very unlikely) My vague guess would be something external preventing syslog-ng to connect to mongodb. Then again, I should tweak the libmongo-client API a bit, so we could provide better error messages. -- |8]
Hello, On 02/02/2011 04:55 PM, Gergely Nagy wrote:
When I try to use mongodb, I receive the following error message:
Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: syslog-ng starting up; version='3.3.0alpha0' Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Network error while inserting into MongoDB; time_reopen='60'
The relevant part of my syslog-ng.conf is (taken from an earlier e-mail on the list):
destination d_mongodb { mongodb( host("localhost") port(27017) database("syslog-ng") collection("logs") keys("date", "facility", "level", "host", "program", "pid", "message") values("${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:${R_MIN}:${R_SEC}", "$FACILITY", "$LEVEL", "$HOST","$PROGRAM", "$PID", "$MSGONLY") ); };
That seems correct. Could it be caused by apparmor or some other similar thing? That was also my first thing to check, but there is no firewall or AppArmor running on the machine.
If not, I'd appreciate if you could send me a strace of syslog-ng (privately, the list would probably reject it anyway).
Will do it tomorrow in the morning... Bye, CzP
Hello, On 02/02/2011 03:45 PM, Peter Czanik wrote:
Hello,
When I try to use mongodb, I receive the following error message:
Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: syslog-ng starting up; version='3.3.0alpha0' Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Network error while inserting into MongoDB; time_reopen='60'
Workaround: when I use IP address (127.0.0.1) instead of hostname (localhost) in the config, it works. Bye, -- Peter Czanik (CzP) <czanik@balabit.hu> BalaBit IT Security / syslog-ng upstream http://czanik.blogs.balabit.com/
On Thu, 2011-02-03 at 09:38 +0100, Peter Czanik wrote:
On 02/02/2011 03:45 PM, Peter Czanik wrote:
Hello,
When I try to use mongodb, I receive the following error message:
Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: syslog-ng starting up; version='3.3.0alpha0' Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Error connecting to MongoDB; Feb 2 15:33:54 linux-8k4b syslog-ng[9403]: Network error while inserting into MongoDB; time_reopen='60'
Workaround: when I use IP address (127.0.0.1) instead of hostname (localhost) in the config, it works.
D'oh. I should've spotted that: the mongodb driver is using inet_addr(), and that only accepts IPv4 dot notation. I'll fix that once I get there, so it will accept host names, IPv4 and IPv6 addresses alike. Thanks for spotting this! -- |8]
participants (2)
-
Gergely Nagy
-
Peter Czanik