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_pgsql: pass connection options to postgresql client #6837

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions plugins/out_pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ static int cb_pgsql_init(struct flb_output_instance *ins,
ctx->db_table = flb_sds_create(FLB_PGSQL_TABLE);
}

/* connection options */
ctx->conn_options = flb_output_get_property("connection_options", ins);

if (!ctx->db_table) {
flb_errno();
pgsql_conf_destroy(ctx);
Expand Down
3 changes: 3 additions & 0 deletions plugins/out_pgsql/pgsql.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ struct flb_pgsql_config {
/* instance reference */
struct flb_output_instance *ins;

/* connections */
const char *conn_options;

/* connections pool */
struct mk_list conn_queue;
struct mk_list _head;
Expand Down
5 changes: 4 additions & 1 deletion plugins/out_pgsql/pgsql_connections.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ void *pgsql_create_connection(struct flb_pgsql_config *ctx)
flb_errno();
return NULL;
}

flb_plg_debug(ctx->ins, "connection_options: %s", ctx->conn_options);
conn->conn = PQsetdbLogin(ctx->db_hostname,
ctx->db_port,
NULL, NULL,
ctx->conn_options,
NULL,
ctx->db_name,
ctx->db_user,
ctx->db_passwd);
Expand Down