Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out_logdna: refactored LogDNA URI formation to support configurable endpoints #8051

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion plugins/out_logdna/logdna.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ static void cb_logdna_flush(struct flb_event_chunk *event_chunk,
FLB_OUTPUT_RETURN(FLB_RETRY);
}
tmp = flb_sds_printf(&uri,
"/logs/ingest?hostname=%s&mac=%s&ip=%s&now=%lu&tags=%s",
"%s?hostname=%s&mac=%s&ip=%s&now=%lu&tags=%s",
ctx->logdna_endpoint,
ctx->_hostname,
ctx->mac_addr,
ctx->ip_addr,
Expand Down Expand Up @@ -532,6 +533,12 @@ static struct flb_config_map config_map[] = {
"LogDNA TCP port"
},

{
FLB_CONFIG_MAP_STR, "logdna_endpoint", FLB_LOGDNA_ENDPOINT,
0, FLB_TRUE, offsetof(struct flb_logdna, logdna_endpoint),
"LogDNA endpoint to send logs"
},

{
FLB_CONFIG_MAP_STR, "api_key", NULL,
0, FLB_TRUE, offsetof(struct flb_logdna, api_key),
Expand Down
2 changes: 2 additions & 0 deletions plugins/out_logdna/logdna.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@

#define FLB_LOGDNA_HOST "logs.logdna.com"
#define FLB_LOGDNA_PORT "443"
#define FLB_LOGDNA_ENDPOINT "/logs/ingest"
#define FLB_LOGDNA_CT "Content-Type"
#define FLB_LOGDNA_CT_JSON "application/json; charset=UTF-8"

struct flb_logdna {
/* Incoming Configuration Properties */
flb_sds_t logdna_host;
int logdna_port;
flb_sds_t logdna_endpoint;
flb_sds_t api_key;
flb_sds_t hostname;
flb_sds_t mac_addr;
Expand Down
Loading