mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-20 02:40:42 +01:00
ommongodb: made ommongodb compile on current rsyslog version
This commit is contained in:
parent
931c63e44b
commit
9a3ff6a2b1
@ -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>
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user