diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-07 16:51:19 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-07 16:51:19 +0100 |
commit | 9a3ff6a2b118070bd33d746078afb45194253b76 (patch) | |
tree | 1f5fe28f25140c59e0c3a0a590a9907118342c7f | |
parent | 931c63e44b7467c857ddd0652beb22ae8ea9af56 (diff) | |
download | rsyslog-9a3ff6a2b118070bd33d746078afb45194253b76.tar.gz rsyslog-9a3ff6a2b118070bd33d746078afb45194253b76.tar.xz rsyslog-9a3ff6a2b118070bd33d746078afb45194253b76.zip |
ommongodb: made ommongodb compile on current rsyslog version
-rw-r--r-- | plugins/ommongodb/README | 17 | ||||
-rw-r--r-- | plugins/ommongodb/ommongodb.c | 27 |
2 files changed, 20 insertions, 24 deletions
diff --git a/plugins/ommongodb/README b/plugins/ommongodb/README index cea3f3bc..445e525c 100644 --- a/plugins/ommongodb/README +++ b/plugins/ommongodb/README @@ -2,6 +2,21 @@ plugin to use MongoDB as backend. tested in ubuntu 10.04 and ubuntu 10.10 +BUILDING THIS PLUGIN +Right now, it seems to be necessary to copy the 10gen c-driver directly under +the ./plugins/ommongodb subdirectory. Then, you need to follow their build +instructions on how to build the mongodb c driver: +http://api.mongodb.org/c/current/building.html + +This is clumpsy, and if someone has ideas on how to improve this situation, +please drop us a line. For obvious reasons, ./configure does not detect +a missing mongodb c driver. + +In order to successfully build ommongodb, you NEED to use the v0.2 version of +the mongo c driver. As it looks, the driver breaks API compatibility and the +curret v0.4 driver seems to have a totally different API (at least this is +what I currently (2012-03-08) see. + configuration: in your /etc/rsyslog.conf, together with other modules: @@ -21,3 +36,5 @@ refactor my code :-) email Victor Pereira <victor.pereira@bigrails.com> twitter twitter.com/vpereira + +part of this doc by Rainer Gerhards <rgerhards@adiscon.com> diff --git a/plugins/ommongodb/ommongodb.c b/plugins/ommongodb/ommongodb.c index ff52624a..bf208754 100644 --- a/plugins/ommongodb/ommongodb.c +++ b/plugins/ommongodb/ommongodb.c @@ -19,6 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "config.h" #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -29,7 +30,6 @@ #include <time.h> #include "bson.h" #include "mongo.h" -#include "config.h" #include "rsyslog.h" #include "conf.h" #include "syslogd-types.h" @@ -52,6 +52,7 @@ #define MONGO_COLLECTION_NAME_SIZE 128 MODULE_TYPE_OUTPUT +MODULE_TYPE_NOKEEP MODULE_CNFNAME("ommongodb") /* internal structures */ @@ -60,6 +61,7 @@ DEFobjCurrIf(errmsg) typedef struct _instanceData { mongo_connection conn[1]; /* ptr */ + //mongo conn[1]; /* ptr */ mongo_connection_options opts[1]; mongo_conn_return status; char db[MONGO_DB_NAME_SIZE]; @@ -106,29 +108,6 @@ CODESTARTdbgPrintInstInfo /* nothing special here */ ENDdbgPrintInstInfo -/* log a database error with descriptive message. - * We check if we have a valid MongoDB handle. If not, we simply - * report an error - */ -static void reportDBError(instanceData *pData, int bSilent) -{ - char errMsg[512]; - bson ErrObj; - - ASSERT(pData != NULL); - - /* output log message */ - errno = 0; - if(pData->conn == NULL) { - errmsg.LogError(0, NO_ERRCODE, "unknown DB error occured - could not obtain MongoDB handle"); - } else { /* we can ask mysql for the error description... */ - //we should handle the error. if bSilent is set then we should print as debug - mongo_cmd_get_last_error(pData->conn, pData->db, &ErrObj); - bson_destroy(&ErrObj); - } - - return; -} /* The following function is responsible for initializing a * MySQL connection. |