-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
out_mongo: add MongoDB as default output plugin
MongoDB output plugin as a default plugin to ease the process of setting up the connection between such databases and Fluent-bit. I've opended an issue for the missing feature: #8846 Signed-off-by: Barnabas Ifkovics <[email protected]>
- Loading branch information
1 parent
7de2c45
commit 6db5c00
Showing
8 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FLB_PLUGIN(out_mongo "mongo.c" "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <fluent-bit/flb_utils.h> | ||
|
||
// USE: #include "mongo.h" | ||
#include <mongoc/mongoc.h> | ||
#include <fluent-bit/flb_output.h> | ||
|
||
static int cb_mongodb_init(struct flb_output_instance *ins, struct flb_config *config, void *data) | ||
{ | ||
mongoc_init(); | ||
printf("Init ran\n"); | ||
return 0; | ||
} | ||
|
||
static void cb_mongodb_flush(struct flb_event_chunk *event_chunk, | ||
struct flb_output_flush *out_flush, | ||
struct flb_input_instance *i_ins, | ||
void *out_context, | ||
struct flb_config *config) | ||
{ | ||
printf("Flush ran\n"); | ||
FLB_OUTPUT_RETURN(FLB_OK); | ||
} | ||
|
||
static int cb_mongodb_exit(void *data, struct flb_config *config) | ||
{ | ||
printf("Exit ran\n"); | ||
return 0; | ||
} | ||
|
||
struct flb_output_plugin out_mongo_plugin = { | ||
.name = "mongo", | ||
.description = "MongoDB", | ||
.cb_init = cb_mongodb_init, | ||
.cb_pre_run = NULL, | ||
.cb_flush = cb_mongodb_flush, | ||
.cb_exit = cb_mongodb_exit, | ||
.config_map = NULL, | ||
.flags = FLB_OUTPUT_NET | FLB_IO_OPT_TLS, | ||
.event_type = FLB_OUTPUT_LOGS | FLB_OUTPUT_METRICS | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef FLB_OUT_MONGO_H | ||
#define FLB_OUT_MONGO_H | ||
|
||
#define FLB_MONGODB_LOCALHOST "127.0.0.1" | ||
#define FLB_MONGODB_PORT 8988 | ||
|
||
struct flb_mongodb { | ||
}; | ||
|
||
#endif // FLB_OUT_MONGO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters