Skip to content

Commit a6a3289

Browse files
committed
pipeline: outputs: es: tests for upstream node configuration properties
Signed-off-by: Marat Abrarov <[email protected]>
1 parent fa23086 commit a6a3289

File tree

3 files changed

+476
-4
lines changed

3 files changed

+476
-4
lines changed

plugins/out_es/es.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ static int cb_es_init(struct flb_output_instance *ins,
645645
return 0;
646646
}
647647

648-
static struct flb_elasticsearch_config *flb_elasticsearch_target(
648+
struct flb_elasticsearch_config *flb_elasticsearch_target(
649649
struct flb_elasticsearch *ctx, struct flb_upstream_node **node)
650650
{
651651
struct flb_elasticsearch_config *ec;

plugins/out_es/es.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <monkey/mk_core/mk_list.h>
2424
#include <fluent-bit/flb_sds.h>
25+
#include <fluent-bit/flb_upstream_node.h>
2526

2627
#define FLB_ES_DEFAULT_HOST "127.0.0.1"
2728
#define FLB_ES_DEFAULT_PORT 9200
@@ -174,4 +175,20 @@ struct flb_elasticsearch {
174175
struct flb_output_instance *ins;
175176
};
176177

178+
/**
179+
* Get plugin configuration.
180+
* In HA mode, the selected upstream node is also output.
181+
* In HA mode, the returned plugin configuration matches the output upstream node.
182+
*
183+
* @param ctx Non-NULL plugin context.
184+
* @param node Non-NULL output parameter for selected upstream node.
185+
* `*node` is set to NULL if not in HA mode or
186+
* there is no upstream node.
187+
*
188+
* @return Configuration of plugin or NULL if error happened or
189+
* there is no upstream node (in HA mode).
190+
*/
191+
struct flb_elasticsearch_config *flb_elasticsearch_target(
192+
struct flb_elasticsearch *ctx, struct flb_upstream_node **node);
193+
177194
#endif

0 commit comments

Comments
 (0)