Skip to content

Commit

Permalink
input: add networking options for server and client inputs to help ou…
Browse files Browse the repository at this point in the history
…tput.

Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Nov 7, 2023
1 parent b436fa6 commit 96f566e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/fluent-bit/flb_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <fluent-bit/flb_coro.h>
#include <fluent-bit/flb_config.h>
#include <fluent-bit/flb_network.h>
#include <fluent-bit/flb_downstream.h>
#include <fluent-bit/flb_upstream.h>
#include <fluent-bit/flb_mem.h>
#include <fluent-bit/flb_str.h>
#include <fluent-bit/flb_bits.h>
Expand Down
47 changes: 47 additions & 0 deletions src/flb_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,53 @@ int flb_help_input(struct flb_input_instance *ins, void **out_buf, size_t *out_s
flb_config_map_destroy(config_map);
}

if (ins->p->flags & FLB_INPUT_NET_SERVER) {
flb_mp_map_header_append(&mh);
pack_str(&mp_pck, "networking");

config_map = flb_downstream_get_config_map(ins->config);
msgpack_pack_array(&mp_pck, mk_list_size(config_map));
mk_list_foreach(head, config_map) {
m = mk_list_entry(head, struct flb_config_map, _head);
pack_config_map_entry(&mp_pck, m);
}
flb_config_map_destroy(config_map);
}
else if (ins->p->flags & FLB_INPUT_NET) {
flb_mp_map_header_append(&mh);
pack_str(&mp_pck, "networking");

config_map = flb_upstream_get_config_map(ins->config);
msgpack_pack_array(&mp_pck, mk_list_size(config_map));
mk_list_foreach(head, config_map) {
m = mk_list_entry(head, struct flb_config_map, _head);
pack_config_map_entry(&mp_pck, m);
}
flb_config_map_destroy(config_map);
}

if (ins->p->flags & (FLB_IO_TLS | FLB_IO_OPT_TLS)) {
flb_mp_map_header_append(&mh);
pack_str(&mp_pck, "network_tls");

config_map = flb_tls_get_config_map(ins->config);
msgpack_pack_array(&mp_pck, mk_list_size(config_map));

/* Adjust 'tls' default value based on plugin type" */
m = mk_list_entry_first(config_map, struct flb_config_map, _head);
if (ins->p->flags & FLB_IO_TLS) {
m->value.val.boolean = FLB_TRUE;
}
else if (ins->p->flags & FLB_IO_OPT_TLS) {
m->value.val.boolean = FLB_FALSE;
}
mk_list_foreach(head, config_map) {
m = mk_list_entry(head, struct flb_config_map, _head);
pack_config_map_entry(&mp_pck, m);
}
flb_config_map_destroy(config_map);
}

flb_mp_map_header_end(&mh);

*out_buf = mp_sbuf.data;
Expand Down

0 comments on commit 96f566e

Please sign in to comment.