Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fluent/fluent-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
edsiper committed Apr 20, 2021
2 parents aeb18f7 + 23aaf15 commit 9c992e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/out_splunk/splunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,13 @@ static void cb_splunk_flush(const void *data, size_t bytes,
ctx->auth_header, flb_sds_len(ctx->auth_header));
}

/* Append Channel identifier header */
if (ctx->channel) {
flb_http_add_header(c, FLB_SPLUNK_CHANNEL_IDENTIFIER_HEADER,
strlen(FLB_SPLUNK_CHANNEL_IDENTIFIER_HEADER),
ctx->channel, ctx->channel_len);
}

/* Content Encoding: gzip */
if (compressed == FLB_TRUE) {
flb_http_set_content_encoding_gzip(c);
Expand Down Expand Up @@ -419,6 +426,12 @@ static struct flb_config_map config_map[] = {
"from the docs for more details to make this option work properly."
},

{
FLB_CONFIG_MAP_STR, "channel", NULL,
0, FLB_TRUE, offsetof(struct flb_splunk, channel),
"Specify X-Splunk-Request-Channel Header for the HTTP Event Collector interface."
},

/* EOF */
{0}
};
Expand Down
6 changes: 6 additions & 0 deletions plugins/out_splunk/splunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define FLB_SPLUNK_DEFAULT_TIME "time"
#define FLB_SPLUNK_DEFAULT_EVENT "event"

#define FLB_SPLUNK_CHANNEL_IDENTIFIER_HEADER "X-Splunk-Request-Channel"

#include <fluent-bit/flb_output_plugin.h>
#include <fluent-bit/flb_sds.h>
#include <fluent-bit/flb_record_accessor.h>
Expand All @@ -47,6 +49,10 @@ struct flb_splunk {
/* Token Auth */
flb_sds_t auth_header;

/* Channel identifier */
flb_sds_t channel;
size_t channel_len;

/* Send fields directly or pack data into "event" object */
int splunk_send_raw;

Expand Down

0 comments on commit 9c992e4

Please sign in to comment.