Skip to content

Instantly share code, notes, and snippets.

@edsiper
Last active June 1, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edsiper/f2c145efbde74987d8fc189252246fd3 to your computer and use it in GitHub Desktop.
Save edsiper/f2c145efbde74987d8fc189252246fd3 to your computer and use it in GitHub Desktop.
test payload
static char *format_payload(void *data, size_t bytes)
{
char *payload;
/* iterate msgpack and compose payload */
return payload;
}
/* This function is only invoked from the runtime test library */
static char *cb_test_payload(...void *data, size_t bytes, ....)
{
return format_payload(data, bytes);
}
static void cb_test_flush(const void *data, size_t bytes,
const char *tag, int tag_len,
struct flb_input_instance *i_ins,
void *out_context,
struct flb_config *config)
{
char *payload;
/* Connect & http client */
/* Format data */
payload = format_payload(data, bytes);
http_do(payload);
FLB_OUTPUT_RETURN(FLB_OK);
}
static int cb_stdout_exit(void *data, struct flb_config *config)
{
return 0;
}
struct flb_output_plugin out_test_plugin = {
.name = "test",
.description = "test",
.cb_init = cb_test_init,
.cb_flush = cb_test_flush,
.cb_exit = cb_test_exit,
.cb_test_payload = cb_test_payload,
.flags = 0,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment