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

in_winevtlog: Make configurable for the size of collecting threshold per a cycle #8677

16 changes: 16 additions & 0 deletions plugins/in_winevtlog/in_winevtlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static int in_winevtlog_init(struct flb_input_instance *in,
struct flb_config *config, void *data)
{
int ret;
int64_t threshold_size;
const char *tmp;
int read_existing_events = FLB_FALSE;
struct mk_list *head;
Expand Down Expand Up @@ -70,6 +71,16 @@ static int in_winevtlog_init(struct flb_input_instance *in,

/* Set up total reading size threshold */
ctx->total_size_threshold = DEFAULT_THRESHOLD_SIZE;
tmp = flb_input_get_property("threshold_size", in);
if (tmp != NULL) {
threshold_size = flb_utils_size_to_bytes(tmp);
if (threshold_size > DEFAULT_THRESHOLD_SIZE) {
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
ctx->total_size_threshold = (unsigned int) threshold_size;
flb_plg_debug(ctx->ins,
"threshold size is changed to %" PRId64 "KB",
threshold_size / 1000);
}
}

/* Open channels */
tmp = flb_input_get_property("channels", in);
Expand Down Expand Up @@ -261,6 +272,11 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct winevtlog_config, event_query),
"Specify XML query for filtering events"
},
{
FLB_CONFIG_MAP_STR, "threshold_size", NULL,
0, FLB_TRUE, 0,
"Specify threshold size for collecting Windows EventLog per a cycle"
},
/* EOF */
{0}
};
Expand Down
Loading