Skip to content

Commit

Permalink
flb_filter: add flb_input_instance to cb_filter callback
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Pettit <[email protected]>
  • Loading branch information
PettitWesley committed Oct 31, 2021
1 parent 18900b7 commit 44198bc
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/fluent-bit/flb_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct flb_filter_plugin {
const char *, int,
void **, size_t *,
struct flb_filter_instance *,
struct flb_input_instance *,
void *, struct flb_config *);
int (*cb_exit) (void *, struct flb_config *);

Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_alter_size/alter_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ static int cb_alter_size_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_size,
struct flb_filter_instance *ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -73,6 +74,7 @@ static int cb_alter_size_filter(const void *data, size_t bytes,
int count = 0;
size_t off = 0;
(void) config;
(void) i_ins;
char tmp[32];
msgpack_unpacked result;
msgpack_object root;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_aws/aws.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,13 @@ static int cb_aws_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context,
struct flb_config *config)
{
struct flb_filter_aws *ctx = context;
(void) f_ins;
(void) i_ins;
(void) config;
size_t off = 0;
int i = 0;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_checklist/checklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ static int cb_checklist_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -406,6 +407,7 @@ static int cb_checklist_filter(const void *data, size_t bytes,
struct flb_time t_diff;

(void) ins;
(void) i_ins;
(void) config;

msgpack_sbuffer_init(&mp_sbuf);
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_expect/expect.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ static int cb_expect_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -399,6 +400,7 @@ static int cb_expect_filter(const void *data, size_t bytes,
(void) out_buf;
(void) out_bytes;
(void) f_ins;
(void) i_ins;
(void) config;
msgpack_object map;
msgpack_object root;
Expand Down
1 change: 1 addition & 0 deletions plugins/filter_geoip2/geoip2.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ static int cb_geoip2_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context,
struct flb_config *config)
{
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_grep/grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static int cb_grep_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context,
struct flb_config *config)
{
Expand All @@ -217,6 +218,7 @@ static int cb_grep_filter(const void *data, size_t bytes,
msgpack_object root;
size_t off = 0;
(void) f_ins;
(void) i_ins;
(void) config;
msgpack_sbuffer tmp_sbuf;
msgpack_packer tmp_pck;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_kubernetes/kubernetes.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ static int cb_kube_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -458,6 +459,7 @@ static int cb_kube_filter(const void *data, size_t bytes,
struct flb_kube_props props = {0};
struct flb_time time_lookup;
(void) f_ins;
(void) i_ins;
(void) config;

if (ctx->use_journal == FLB_FALSE || ctx->dummy_meta == FLB_TRUE) {
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_lua/lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,14 @@ static int cb_lua_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
int ret;
size_t off = 0;
(void) f_ins;
(void) i_ins;
(void) config;
double ts = 0;
msgpack_object *p;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_modify/modify.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,11 +1277,13 @@ static int cb_modify_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t * out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context, struct flb_config *config)
{
msgpack_unpacked result;
size_t off = 0;
(void) f_ins;
(void) i_ins;
(void) config;

struct filter_modify_ctx *ctx = context;
Expand Down
2 changes: 1 addition & 1 deletion plugins/filter_multiline/ml.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ static int cb_ml_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -166,7 +167,6 @@ static int cb_ml_filter(const void *data, size_t bytes,
(void) out_buf;
(void) out_bytes;
(void) f_ins;
(void) filter_context;
(void) config;
msgpack_unpacked result;
msgpack_object *obj;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_nest/nest.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,13 @@ static int cb_nest_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t * out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context, struct flb_config *config)
{
msgpack_unpacked result;
size_t off = 0;
(void) f_ins;
(void) i_ins;
(void) config;

struct filter_nest_ctx *ctx = context;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_parser/filter_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ static int cb_parser_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **ret_buf, size_t *ret_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context,
struct flb_config *config)
{
Expand All @@ -190,6 +191,7 @@ static int cb_parser_filter(const void *data, size_t bytes,
msgpack_unpacked result;
size_t off = 0;
(void) f_ins;
(void) i_ins;
(void) config;
struct flb_time tm;
msgpack_object *obj;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_record_modifier/filter_modifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ static int cb_modifier_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context,
struct flb_config *config)
{
Expand All @@ -265,6 +266,7 @@ static int cb_modifier_filter(const void *data, size_t bytes,
int map_num = 0;
bool_map_t *bool_map = NULL;
(void) f_ins;
(void) i_ins;
(void) config;
struct flb_time tm;
struct modifier_record *mod_rec;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_rewrite_tag/rewrite_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ static int cb_rewrite_tag_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -371,6 +372,7 @@ static int cb_rewrite_tag_filter(const void *data, size_t bytes,
msgpack_unpacked result;
struct flb_rewrite_tag *ctx = (struct flb_rewrite_tag *) filter_context;
(void) config;
(void) i_ins;

#ifdef FLB_HAVE_METRICS
ts = cmt_time_now();
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_stdout/stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static int cb_stdout_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -49,6 +50,7 @@ static int cb_stdout_filter(const void *data, size_t bytes,
(void) out_buf;
(void) out_bytes;
(void) f_ins;
(void) i_ins;
(void) filter_context;
(void) config;
struct flb_time tmp;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_tensorflow/tensorflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ static int cb_tf_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_bytes,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *filter_context,
struct flb_config *config)
{
Expand All @@ -235,6 +236,7 @@ static int cb_tf_filter(const void *data, size_t bytes,
(void) out_buf;
(void) out_bytes;
(void) f_ins;
(void) i_ins;
int map_size;

msgpack_object root;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_throttle/throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static int cb_throttle_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t *out_size,
struct flb_filter_instance *f_ins,
struct flb_input_instance *i_ins,
void *context,
struct flb_config *config)
{
Expand All @@ -228,6 +229,7 @@ static int cb_throttle_filter(const void *data, size_t bytes,
msgpack_object root;
size_t off = 0;
(void) f_ins;
(void) i_ins;
(void) config;
msgpack_sbuffer tmp_sbuf;
msgpack_packer tmp_pck;
Expand Down
2 changes: 2 additions & 0 deletions plugins/filter_throttle_size/throttle_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ static int cb_throttle_size_filter(const void *data, size_t bytes,
const char *tag, int tag_len,
void **out_buf, size_t * out_size,
struct flb_filter_instance *ins,
struct flb_input_instance *i_ins,
void *context, struct flb_config *config)
{
int ret;
Expand All @@ -669,6 +670,7 @@ static int cb_throttle_size_filter(const void *data, size_t bytes,
msgpack_object map;
size_t off = 0;
(void) ins;
(void) i_ins;
(void) config;
msgpack_sbuffer tmp_sbuf;
msgpack_packer tmp_pck;
Expand Down
2 changes: 2 additions & 0 deletions src/flb_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void flb_filter_do(struct flb_input_chunk *ic,
ssize_t write_at;
struct mk_list *head;
struct flb_filter_instance *f_ins;
struct flb_input_instance *i_ins = ic->in;

/* For the incoming Tag make sure to create a NULL terminated reference */
ntag = flb_malloc(tag_len + 1);
Expand Down Expand Up @@ -127,6 +128,7 @@ void flb_filter_do(struct flb_input_chunk *ic,
&out_buf, /* new data */
&out_size, /* new data size */
f_ins, /* filter instance */
i_ins, /* input instance */
f_ins->context, /* filter priv data */
config);

Expand Down

0 comments on commit 44198bc

Please sign in to comment.