Skip to content

Commit 2be7535

Browse files
committed
in_winevtlog: Add text format for event rendering
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent a3c457f commit 2be7535

4 files changed

Lines changed: 567 additions & 1 deletion

File tree

plugins/in_winevtlog/in_winevtlog.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,24 @@ static int in_winevtlog_init(struct flb_input_instance *in,
189189
return -1;
190190
}
191191

192+
/* Rendering options are mutually exclusive */
193+
if (ctx->render_event_as_xml && ctx->render_event_as_text) {
194+
flb_plg_error(in,
195+
"render_event_as_xml and render_event_as_text cannot be enabled at the same time");
196+
flb_log_event_encoder_destroy(ctx->log_encoder);
197+
flb_free(ctx);
198+
return -1;
199+
}
200+
201+
if (ctx->render_event_as_text) {
202+
if (ctx->render_event_text_key == NULL || ctx->render_event_text_key[0] == '\0') {
203+
flb_plg_error(in, "render_event_text_key cannot be empty when render_event_as_text is enabled");
204+
flb_log_event_encoder_destroy(ctx->log_encoder);
205+
flb_free(ctx);
206+
return -1;
207+
}
208+
}
209+
192210
if (ctx->backoff_multiplier_str && ctx->backoff_multiplier_str[0] != '\0') {
193211
mult = atof(ctx->backoff_multiplier_str);
194212
if (mult <= 0.0) {
@@ -464,7 +482,17 @@ static struct flb_config_map config_map[] = {
464482
{
465483
FLB_CONFIG_MAP_BOOL, "render_event_as_xml", "false",
466484
0, FLB_TRUE, offsetof(struct winevtlog_config, render_event_as_xml),
467-
"Whether to consume at oldest records in channels"
485+
"Render Windows EventLog as XML (System and Message fields)"
486+
},
487+
{
488+
FLB_CONFIG_MAP_BOOL, "render_event_as_text", "false",
489+
0, FLB_TRUE, offsetof(struct winevtlog_config, render_event_as_text),
490+
"Render Windows EventLog as newline-separated key=value text"
491+
},
492+
{
493+
FLB_CONFIG_MAP_STR, "render_event_text_key", "log",
494+
0, FLB_TRUE, offsetof(struct winevtlog_config, render_event_text_key),
495+
"Record key name used when render_event_as_text is enabled"
468496
},
469497
{
470498
FLB_CONFIG_MAP_BOOL, "use_ansi", "false",

0 commit comments

Comments
 (0)