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_loki: add new option 'uri' to customize HTTP URI endpoint #8040

Merged
merged 1 commit into from
Oct 13, 2023
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_loki/loki.c
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ static void cb_loki_flush(struct flb_event_chunk *event_chunk,
}

/* Create HTTP client context */
c = flb_http_client(u_conn, FLB_HTTP_POST, FLB_LOKI_URI,
c = flb_http_client(u_conn, FLB_HTTP_POST, ctx->uri,
out_buf, out_size,
ctx->tcp_host, ctx->tcp_port,
NULL, 0);
Expand Down Expand Up @@ -1726,13 +1726,20 @@ static int cb_loki_exit(void *data, struct flb_config *config)

/* Configuration properties map */
static struct flb_config_map config_map[] = {
{
FLB_CONFIG_MAP_STR, "uri", FLB_LOKI_URI,
0, FLB_TRUE, offsetof(struct flb_loki, uri),
"Specify a custom HTTP URI. It must start with forward slash."
},

{
FLB_CONFIG_MAP_STR, "tenant_id", NULL,
0, FLB_TRUE, offsetof(struct flb_loki, tenant_id),
"Tenant ID used by default to push logs to Loki. If omitted or empty "
"it assumes Loki is running in single-tenant mode and no X-Scope-OrgID "
"header is sent."
},

{
FLB_CONFIG_MAP_STR, "tenant_id_key", NULL,
0, FLB_TRUE, offsetof(struct flb_loki, tenant_id_key_config),
Expand Down
2 changes: 2 additions & 0 deletions plugins/out_loki/loki.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ struct flb_loki {
/* Public configuration properties */
int auto_kubernetes_labels;
int drop_single_key;

flb_sds_t uri;
flb_sds_t line_format;
flb_sds_t tenant_id;
flb_sds_t tenant_id_key_config;
Expand Down
Loading